Skip to content

useSelector question #1785

Answered by dai-shi
AleksandrukTad asked this question in Q&A
Feb 22, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Will it rerender FirstName component?

No. I think it work as you expect.

useSelector is a bit old, current recommendation would be simply deriving atoms:

const errorsAtom = atom({ firstName: "", secondName: "", lastName: "" })

const firstNameErrorAtom = atom((get) => get(errorsAtom).firstName);
const secondNameErrorAtom = atom((get) => get(errorsAtom).secondName);
const lastNameErrorAtom = atom((get) => get(errorsAtom).lastName);

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tjx666
Comment options

@dai-shi
Comment options

Answer selected by AleksandrukTad
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