docs(create): document that state cannot be read during initialization (#3569)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* docs(create): document that state cannot be read during initialization The store api passed to the state creator function is not usable for reading state while that function runs: get() and store.getState() return undefined, and store.getInitialState() throws "Cannot access 'initialState' before initialization". Per the discussion, this is a designed limitation rather than a bug, so document it in the create and createStore troubleshooting sections. Ref: https://github.com/pmndrs/zustand/discussions/3529 * docs(create): shorten init-time state access note to a one-line caveat Per review feedback, the troubleshooting section was too long for such a subtle behavior. Replace it with a one-line note on the stateCreatorFn parameter in both create and createStore. ---------
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: fandi <irfanfandi38@gmail.com>
Diff stats
2 files+4 added−2 removed
- other:+4 added−2 removed