Thank you for your suggestion on useReducer, I read something about it and I think it could make the code a little less cumbersome. I know there are some libraries like redux that simplifies the state management a lot, and, as you said, they will be a lot more efficient than a custom approach. If I'll be doing something for production I'll go that way for sure, but as in this case I'm exploring the framework I wanted to use as much as "pure react" as I can to understand how it works.