DEV Community

Cover image for Tips for Organizing React Projects

Tips for Organizing React Projects

Chris Achard on March 18, 2020

This was originally posted as a twitter thread: https://twitter.com/chrisachard/status/1239993582397816838 There is no One Way React is a librar...
Collapse
 
nasidulislam profile image
Nasidul Islam

Great tips ! However, I want to say, about codebase file structure, I think its best to find out what works for you early on in your career and stick to that --- regardless of the size of the project. This makes navigating around files a muscle memory action for you and also, later when the codebase starts to get complicated, it can be a hassle to re-organize everything and have everything regression tested.

Collapse
 
apiwonska profile image
Anna Piwońska • Edited

What a pity that I haven't seen this before! I spent too much time figuring out how to organize my react project. Anyway I came to almost identical solution like you describe. Except I didn't know absolute imports. Thanks for reassuring me and showing absolute imports! Very helpful!

Collapse
 
raisaugat profile image
Saugat Rai

This is exactly the folder pattern that we are using in one of our project. It's much simpler and manageable. You're right about the css one. Having the css file in the same component folder where it is use is pretty much easier.

Collapse
 
pandaa880 profile image
Prashant Chaudhari

I am glad that i was already following 80% of what you mentioned. I learned that from a project repo of Kent C Dodds and it has been super useful till now.

This is pretty solid structure.

Collapse
 
masharsamue profile image
Samuel Mashar

great tutorial I think it would have been even better if you went along with a simple project. Great explaining though

Collapse
 
totally_waqas profile image
Waqas

Great tips. Btw to add to no. 7, I prefer not using default exports for these reasons.

Collapse
 
chrisachard profile image
Chris Achard

Ah interesting post - thanks!

Collapse
 
muhammadawaisshaikh profile image
Muhammad Awais

great.

Collapse
 
dferdian19 profile image
Dipa Ferdian

Thanks @chriz Achard, you teaching to easier learn with concept 🥰

Collapse
 
piratex profile image
Chhay Toch

Love you so much !!

Collapse
 
rajtslegr profile image
Petr Rajtslegr

Great one! Thanks!