Redux: Rename createStore() second argument from initialState to preloadedState

Created on 18 May 2016  Â·  8Comments  Â·  Source: reduxjs/redux

It has caused enough confusion. This argument is only meant for providing persisted state, not for putting an object literal with all app’s initial state in one place. We should make it more clear by renaming the argument both in the source and everywhere in the docs.

docs help wanted

Most helpful comment

My only argument to keep it as initialState is when referring to "currentState" it sounds more fluid to say "initial" -> "current" as opposed to "preloaded" -> "current".

All 8 comments

(Arguably it’s also used for server rendering. Alternative naming suggestions are welcome. I just want to make it clear that it’s supposed to be generated and not written by hand.)

importedState? preloadedState?

preloadedState looks better. More ideas are welcome.

defaultState

preloadedState looks good. Then how about stateToSync?

My only argument to keep it as initialState is when referring to "currentState" it sounds more fluid to say "initial" -> "current" as opposed to "preloaded" -> "current".

W00t! Actually rather amused that my offhand suggestion of "preloadedState" worked out :)

:-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

caojinli picture caojinli  Â·  3Comments

timdorr picture timdorr  Â·  3Comments

ilearnio picture ilearnio  Â·  3Comments

dmitry-zaets picture dmitry-zaets  Â·  3Comments

cloudfroster picture cloudfroster  Â·  3Comments