DEV Community

Discussion on: Opinionated React: Folder Structure & File Naming

Collapse
 
jannikwempe profile image
Jannik Wempe

Interesting...
I have a similar approach. Would be very interesting to see the structure inside of /components. Is there any nesting? A folder for each component with styles/test/... next to the component file itself? A single index.ts to re-export all components? Or a index.tsx in every components folder?

As you can see, I think there are many different approaches to the /components folder. Would love a followup article or edit on that.

Do you have any project where you applied that structure, that you can share? Would be interested in some API files.

Thanks :)

Collapse
 
farazamiruddin profile image
faraz ahmad • Edited

I don't use any nesting in any of the folders. The shape of of my components folder is like so:

/components
  /__tests__
    Button.test.tsx
Button.tsx

I usually don’t have styles files in my apps. I use plain css frameworks like tailwind or bootstrap so there is not a separate styles file.