Keep a collection of
yo-yo
components.
npm install yo-yo-collection
Needed a way to handle state and update of multiple small yo-yo
components. Inspired by choo.
const collection = new Collection()
// Add a component to the collection
collection.component(function (state, bus) {
return yo`<div>${state.data}</div>`
})
// Add a store
collection.store(function (state, bus) {
bus.on('data', function (data) {
state.data = data
bus.emit('rerender')
})
})
MIT