Skip to content

Clarification on using getState() vs useStore and potential side effects #2712

Answered by dbritto-dev
maurosaladino asked this question in Q&A
Discussion options

You must be logged in to vote

@maurosaladino yeah, sure. The only different between accessing state using getState() and useStore(...) in React is that you could end up having extra re-renders by accessing to the state using getState(), in the other hand you could improve your perf by memoizing selectors using useStore(...)

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@dbritto-dev
Comment options

@maurosaladino
Comment options

@dbritto-dev
Comment options

Answer selected by dbritto-dev
@JonnyAxelsson
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants