filmov
tv
ReactJS Opinionated Component Folder Structure Create-React-App (CRA) TypeScript Project

Показать описание
When you work on a React project and the code keeps growing in size, it can become overwhelming as it often includes a large number of components, and then it can be hard to find and maintain.
A neat way to organize your components so it makes it easier to find is to split the component into a separated component type.
This is my recommended folder structure to get started, however, feel free to change and use it as a suggestion only.
To create this structure create these folders.
- src/components
- src/features
- src/layout
- src/pages
- src/redux
- src/recoil/atoms
- src/recoil/selectors
If you on a Mac you can use this one-liner in Terminal;
$ mkdir src/components src/features src/layout src/pages src/redux src/recoil src/recoil/atoms src/recoil/selectors
Take the Digital Course & Get 40 Pages React Book
Get Free React 17 Book Chapter
View the article on Medium
Learning React?
A neat way to organize your components so it makes it easier to find is to split the component into a separated component type.
This is my recommended folder structure to get started, however, feel free to change and use it as a suggestion only.
To create this structure create these folders.
- src/components
- src/features
- src/layout
- src/pages
- src/redux
- src/recoil/atoms
- src/recoil/selectors
If you on a Mac you can use this one-liner in Terminal;
$ mkdir src/components src/features src/layout src/pages src/redux src/recoil src/recoil/atoms src/recoil/selectors
Take the Digital Course & Get 40 Pages React Book
Get Free React 17 Book Chapter
View the article on Medium
Learning React?