simred-deku

1.0.4 • Public • Published

simred-deku NPM version Build Status Tests Coverage

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 the connect() and the custom render() 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

Package Sidebar

Install

npm i simred-deku

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

11.8 kB

Total Files

12

Last publish

Collaborators

  • gaelph