What are the common folder structures for React?
There are two common practices for React project file structure.
-
Grouping by features or routes:
One common way to structure projects is locate CSS, JS, and tests together, grouped by feature or route.
common/├─ Avatar.js├─ Avatar.css├─ APIUtils.js└─ APIUtils.test.jsfeed/├─ index.js├─ Feed.js├─ Feed.css├─ FeedStory.js├─ FeedStory.test.js└─ FeedAPI.jsprofile/├─ index.js├─ Profile.js├─ ProfileHeader.js├─ ProfileHeader.css└─ ProfileAPI.js -
Grouping by file type:
Another popular way to structure projects is to group similar files together.
api/├─ APIUtils.js├─ APIUtils.test.js├─ ProfileAPI.js└─ UserAPI.jscomponents/├─ Avatar.js├─ Avatar.css├─ Feed.js├─ Feed.css├─ FeedStory.js├─ FeedStory.test.js├─ Profile.js├─ ProfileHeader.js└─ ProfileHeader.css
October 10, 2022
742
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS