Where to put constants and types React Typescript

I am curious to know where on should put constants and types that are used in many parts of the app. What is the best practice to organize this? Thanks!

Submitted December 27th 2020 by Admin


Putting files and and making good structure of is an art and very crucial for large scale application. For the best practice our code should not have any constants inside our component we should decide a common place to put all of our constants and type. So that we make less mistakes and follow the dry(don't repeat yourself) principle.

we should keep our constant and type like this...

put all of your types inside modules folder with this navigation


and put you constants in utils folder with this navigation


Again it depends how you are structuring your project. Happy Learning

Admin | 9 months ago

Relevant Questions