simred-deku
v1.0.4
Published
Deku bindings for Simred
Downloads
7
Maintainers
Readme
simred-deku
Deku bindings for Simred
If you do know what Simred is, take a look at the project's GitHub page.
If Deku is unknown to you, pay a visit to its GitHub repo.
It works more like react-redux
rather than using the context/dispatch parameters in deku.
However, I thought it would be better to only give access to the store to components that
actually require it, i.e. Container Components.
Note to React users Deku doesn't require the use of a
<Provider/>
Component. The simple use of theconnect()
and the customrender()
functions will suffice.
Installation
$ npm install --save simred-deku
Usage
Implementing a Container Component
import { connect } from 'simred-deku'
import { Component } from './component'
const mapStateToProps = (state, ownProps) => {
const { todos, filter} = state
return { todos }
}
const mapActionsToProps = (actions, ownProps) => {
const { add } = actions.todos
return { addTodo: add}
}
export const Container = connect(
mapSateToProps,
mapActionsToProps,
)(Component)
Passing the Store to the app
import Simred from 'simred'
import { rootReducer } from './reducers'
import { element } from 'deku'
import { render } from 'simred-deku'
import { App } from './components'
const store = Simred.createStore(rootReducer)
render( <App />, store, document.getElementById('root'))
License
MIT © Gaël PHILIPPE