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鈥檚 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鈥檚 also used for server rendering. Alternative naming suggestions are welcome. I just want to make it clear that it鈥檚 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