There is no right or wrong way when creating a React application. Being a library react doesn't have any pre defined structure for an application

How to Organise a React Application

submited by
Style Pass
2021-09-25 06:30:03

There is no right or wrong way when creating a React application. Being a library react doesn't have any pre defined structure for an application, it gives us a lot of freedom to do things. Most of the time what people tend to do is create a components folder and use that as a place to store your complete application, this is not very scaleable solution and the code becomes difficult to test or add features to. I like to keep my code structure in a way so that they are easy to test, being very obvious which makes adding features easy.

I generally use Create React App for bootstrapping my react application, and add some custom configuration using craco (Create React App Configuration Override).

When a react application grows in size and complexity various problems also arise, managing imports is one of them. Aliases just makes importing from anywhere inside the project easy, also moving files is a very less hassle, you can easily do something like import Component from @components/my-component.

As Create React App getting started template already comes bundled with eslint I tend to leave the linting to it, and only add custom configurations if required to the eslint config file, or else we are good to go.

Leave a Comment