alp-react-redux
render with react and redux in alp framework
How to install
npm install --save koa@2 alp-react-redux
Examples
With Koa
;;; const app = ;app; // ... { ctx;}
With Ibex
;;; const const app = ;app; // ... { ctx;}
How it works
alp-react-redux
render react components.
It add in Koa's context (or Ibex's context) the following method:
render(moduleDescriptor, data)
moduleDescriptor
is an object with two properties: View
and optional reducer
. If the reducer is not set, the view is rendered as a simple component.
data
is an object with the initial data, sent to redux as the initial data for the store, or to react simple component as properties
For browser, this package keeps a single redux store, and reinitialize it each time the render
method is called.
createAction / createReducer
Reduce some boilerplate in your application:
; const increment = ;const addTodo = ; // addTodo({ name: 'Todo Name' })const removeTodo = ; // removeTodo(todo.id) addTodo: ...todos todo removeTodo: todos;