React · Junior · Question 22 of 75

Two sibling components need the same data, which they can change. What should you do first?

Explanation

Lifting state up is a basic technique: data should have a single source of truth in the closest common ancestor. Duplicating state and syncing it with effects leads to desync and extra renders. Global stores are needed when state is really used in many places in the tree.

Further reading

Problem with a question

React · Junior · question 22

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz