Structuring React projects
After learning about the principles of React, how to use the State Hook, and how Hooks work internally, we are now going to make use of the real State Hook to develop a blog application. In this section, we are going to structure the folders in a way that will allow us to scale the project later.
Folder structure
There are many ways that projects can be structured, and different structures can do well for different projects. Usually, it’s a good idea to create a src/
folder for all source code, to distinguish it from assets and configuration files. Inside this folder, one possible structure is to group the files by features. Another popular way to structure projects is to group the files by routes. For some projects, it might make sense to additionally separate by file type, such as src/api/
and src/components/
. However, for our project, we are mainly going to focus on the user interface (UI). So, we are going to group our files by features...