Skip to content

Instantly share code, notes, and snippets.

@dabbott
Last active October 14, 2016 18:37
Show Gist options
  • Save dabbott/3fb41d149f5c8cc0f39f9f1f6acbe163 to your computer and use it in GitHub Desktop.
Save dabbott/3fb41d149f5c8cc0f39f9f1f6acbe163 to your computer and use it in GitHub Desktop.
Yops Redux API
// In Deco
const mapStateToProps = (state) => createSelector(
(state) => state.storyboard,
(storyboard) => ({
storyboard,
})
)
class Storyboard extends Component {
const {storyboard, dispatch, fileId} = this.props
render() {
<YOPS
// The currently running storyboard
storyboardId={fileId}
// State for all storyboards
state={storyboard}
// Allow Yops to fire actions
dispatch={dispatch}
/>
}
}
// In Yops
// Owner applies this middleware to the redux store
export { syncServiceMiddleware } from './middlewares'
// Owner adds this reducer to the redux store via combineReducers
export storyboardReducer from './reducers'
// 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, passing in storyboard state
export default from './containers/Root'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment