ckirkendall / kioo

Enlive/Enfocus style templating for Facebook's React and Om in ClojureScript.
Eclipse Public License 1.0
404 stars 39 forks source link

Added custom selector setup with first-match and nth-match as defaults #73

Closed ckirkendall closed 7 years ago

ckirkendall commented 7 years ago

This adds the ability to register custom selectors to a naked symbol and provides two new selectors not in enlive (first-match and nth-match).

example usage:

(kioo/register-selector! nth-match kioo.core/nth-match)  

note: the second symbol must include the fully qualified namespace for this to work.

ckirkendall commented 7 years ago

@alesguzik - I finally got around to adding in a custom selector setup. The selectors first-match and nth-match should eliminate the need for https://github.com/ckirkendall/kioo/pull/57

This allows custom selectors to be added by the user but provides a set of base selectors as defaults in addition to the enlive selectors.

ckirkendall commented 7 years ago

Thanks, I am writing tests right now for that.

alesya-h commented 7 years ago

I really like the approach! I thought it could be close to impossible with state because the component is rerendered, but didn't realised that selectors are actually executed only once, at compile-time. Great work!