Skip to content

Is consuming state with this short one-liner a performance killer? #744

Closed Answered by drcmda
DoneDeal0 asked this question in Q&A
Discussion options

You must be logged in to vote

the first triggers on every state update, but if im not mistaken it carries out unnecessary checks for each top level state prop which isn't good. all components using that will render. the slowest.

the second will trigger once bears and/or hunters are changed, it will bail out on everything else.

the third triggers on every state update, but it's still just a single check (oldState === newState). all components using that will render.

hooks should start with "use" - no linter would let "bearStore" pass, that's just conventions though.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DoneDeal0
Comment options

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