1.0.4 • Published 5 years ago

simred-deku v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago