DEV Community

Discussion on: Building the Same App 5 Times

Collapse
 
busches profile image
Scott Busche

The React example is overly complicated, why track the new note title/description in App? You can keep addNote and have it take a note argument that the AddNote component can create. NotesList should own the notes list as well. Tracking everything in App and passing it down is the opposite of what hooks are meant to do.

Collapse
 
sammyshear profile image
Sammy Shear

I think you are correct here. I'm a little puzzled as to how I didn't think this through better at any point, because this is how I often structure similar apps, but overall I think your method makes more sense. I will probably make the simplifications you suggested and then edit this or write a follow-up detailing the reasoning. I think the only real reason I ever started using hooks this way would be because I learned them just by using them, so I guess it just made sense when I was first building apps with hooks, and it stuck with me without me ever really thinking about it.