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

override the default state #98

Open
flynorc opened this issue Mar 7, 2019 · 1 comment
Open

override the default state #98

flynorc opened this issue Mar 7, 2019 · 1 comment

Comments

@flynorc
Copy link

flynorc commented Mar 7, 2019

Is there a way to simply override the default i18nState values when initializing the reducer?

I would need to override the lang property of it based on another value stored in a configuration file.

i've found this in the docs, but nothing on how to override the defaults. What i'm thinking now is to just manually call the action to set the language after it has been initialized, but would like to know if there is a better more direct way to do it already while initializing.

import {otherreducers} from "./Yourproject"

import {i18nState} from "redux-i18n"
// with Immutable.js:
import {i18nState} from "redux-i18n/immutable"

const appReducer = combineReducers({
  otherreducers,
  i18nState //here I would like to somehow pass the default lang value, if possible
})
@metsawyr
Copy link

metsawyr commented Apr 2, 2019

@flynorc you should use 2nd argument of createStore function to initialize state. But this won't override lang. Lang should be passed in props anyway.

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

2 participants