@skele/classic
Version:
Skele is an architectural framework that assists with building data-driven apps with React or React Native.
35 lines (23 loc) • 832 B
Markdown
Updates are functions that enable simple transformations of elements. An update is triggered via dispatching of actions.
Registers an update to a specific kind and action type.
```javascript
import { update } from '@skele/classic'
update.register(['scene', 'article'], 'toggleIsBookmarked', el =>
el.set('isBookmarked', !el.get('isBookmarked'))
)
```
Registers updates to a specific kind using a registration function.
```javascript
import { update } from '@skele/classic'
update.forKind(['scene', 'article', 'briefing'], updates => {
updates.register('toggleIsBookmarked', el =>
el.set('bookmarked', !el.get('bookmarked'))
)
updates.register('toggleIsRead', el => el.set('isRead', !el.get('isRead')))
})
```