user181351
user181351

Reputation:

cycle.js How to select element from instance of component

With cycle.js I am trying to create a reusable component that can exist multiple times of the page, including event handlers.

When using DOMSource.select it seems to be matching on the entire app container. Is there a way I can .select from only my (this instance of the component's) sub elements?

Upvotes: 0

Views: 203

Answers (2)

Brian C.
Brian C.

Reputation: 7976

If you have a single component or just a few, isolate() mentioned by tm1rbrt works well and is simple to use.

If you have a large list of objects to render as components, especially if you have to update that list, try out cycle.js collections: https://github.com/cyclejs/collection

Upvotes: 0

user181351
user181351

Reputation:

The answer was to use isolate(). It's somewhat similar to every Iterable item in react needing a key attribute.

Upvotes: 0

Related Questions