DEV Community

Discussion on: How I structure my React.js projects

Collapse
 
victorocna profile image
Victor Ocnarescu

Maybe it's better to organize by both. How about a generic hook like useModal that can be used by ANY modal in your project. Isn't organizing it by nature a better model than anything else?

Collapse
 
insidewhy profile image
insidewhy

Add it to an open source library or a utils folder in the root or even modals or utils/modals. Not hooks folder. At my current job we use a monorepo and have subpackages for things like this so we can share generic functionality with many projects.