Skip to content

Instantly share code, notes, and snippets.

@dabbott
Last active October 14, 2016 18:52
Show Gist options
  • Save dabbott/8d287cd27e31b7699b34de83c81da7fa to your computer and use it in GitHub Desktop.
Save dabbott/8d287cd27e31b7699b34de83c81da7fa to your computer and use it in GitHub Desktop.
Yops Redux API 2
// In Deco
class Storyboard extends Component {
const {storyboard, dispatch, fileId} = this.props
render() {
<YOPS
// The currently running storyboard
storyboardId={fileId}
/>
}
}
// In Yops
// Store is created as a singleton, shared between all instances of Yops
// - data is keyed by storyboard filePath
// - to read data, owner calls store.getState()
// - to fire actions, owner calls e.g. store.dispatch(storyboardActions.addScene())
export storyboardStore from './store'
// Owner calls these actions to update the storyboard state
// - we'll probably only expose a subset of the actions
// - there will be actions specifically for saying "this is the source of truth,
// update no matter what"
export storyboardActions from './actions'
// Owner renders this component
export default from './containers/Root'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment