frintjs / frint-props

Compose reactive props in FrintJS applications
https://frint.js.org
MIT License
12 stars 1 forks source link

Create `withReducer` function #36

Open fahad19 opened 6 years ago

fahad19 commented 6 years ago

Usage example

import { compose, withReducer } from 'frint-props';

const props$ = compose(
  withReducer(
    'counterState',
    'dispatchCounter',
    (state, action) => state,
    { counter: 0 }
  )
)();

API

withState(
  stateName: string,
  dispatchName: string,
  reducer: (state, action) => state,
  initialState
)