Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle initial state on store create #39

Open
desktoping opened this issue Apr 21, 2017 · 0 comments
Open

Handle initial state on store create #39

desktoping opened this issue Apr 21, 2017 · 0 comments

Comments

@desktoping
Copy link

desktoping commented Apr 21, 2017

how do we handle initial state as state passed down by store?

const initialState = {
  count: 1
}

export default (reducers) => (
  createStore(
    combineReducer(reducers),
    initialState,
    applyMiddleware(...)
  )
)

do we have access to the initial state on State?

export default State('count', {
  initial: {
    count: state.count || 1 // should be the same as the initialized value
  },
  addCount,
  subCount
})

EDIT
sorry it seems i went ahead not looking at the source.
https://github.com/jumpsuit/jumpstate/blob/master/src/state.js#L32
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant