SyntaxFix
Write A Post
Hire A Developer
Questions
The first solution, with keeping the state in parent component, is the correct one. However, for more complex problems, you should think about some state management library, redux is the most popular one used with react.