23
loading...
This website collects cookies to deliver better user experience
src
folder in which I place several folders:App
— The folder where the main component is placed containing global providers and main routing.components
— Where every React component of the application belongs.gql
— In which I can find every piece of a GraphQL request I can make in my application.libs
— This is a bit of a mess, but it contains everything else. It is generally composed of fewer than ten files, so I never had to split them better.components
folder will be a bit more complex.ui
folder doesn’t make sense in a Material-UI application.hooks
— Where I place a good amount of the hooks I use in my app. I have a lot of them to embrace the power of reusability, so I also create subfolders to illustrate the job they belong to. For example, I often have a useInterval
hook to handle cyclic jobs. I also place in there a useUser
hook that gives me the current connected user information.modals
— This regroups every modal in my project. I used to place them elsewhere, but I actually found that I often use them many times in the application, and they are quite numerous. By having their own folder, it became simpler for me to work on them.organisms
— The folder where I place the functional components I spoke about earlier. It can be split into subfolders if there are too many of them, which happens a lot.providers
— Components that contain global data or feature logic. To find out more about what a provider looks like, I invite you to take a look at a previous post where I replace redux with them.svg
— The home of every icon used in the application since create-react-app can include them natively. You might have a designer, but in case you don’t, I really love the Material Design Iconset, where I can always find the perfect icon for my apps.templates
— In which I have the page layouts of my atomic design application. It’s not the richest folder of the app, but taking into consideration what the layouts are for, they are better isolated.ui
— Where the atoms and molecules of my application are. This is one of the heaviest folders in the application, so it is split up by domain subfolders.pages
— This corresponds to the pages defined in my application. This is the most complex folder because it is recursive. We’ll talk about it in a specific chapter right after this one./user/login
/user/account
/todo/list
/todo/details/123
/user
will redirect to /user/dashboard
, for example./
will probably also redirect to /user/dashboard
.useTodoList
hook is only used in the /todo/list
page and the TodoItem
component also.components
folder with every folder defined earlier but pages
.