8

I have to build a frontend project from scratch.

This project is ambitious and will last for a long time. My main goal in this first weeks of development will be to start on a good basis.

Therefore, i'm wondering if create-react-app is a good option because it's easy to begin with and this toolbox is optimized for production.

However, how modular my project will be if i use this solution ?

Does anybody know if some drawback can appear on project using CRA ?

My main worry is about bundler.

If the project is getting bigger and bigger, do i have to optimize the webpack config of CRA ?

Isn't better to create my project from scratch with my own bundler configuration ?

Sinane
  • 1,614
  • 2
  • 12
  • 17

2 Answers2

8

CRA is a lightweight environment which generates the HTML on the client side (browser).

Which means it goes under the advantages and drawbacks of Client Side Renderding (google it).

For CRA advantages see docs.

Disadvantages:

  • Opinionated setup (like almost all tools).
  • Hard to configure.

I don't think there are more interesting drawbacks to talk about.


Very important side note: the developing cycle should be decoupled from the production environment.

There are some fundamental issues that I want to tackle because I see many questions resemble this one.

React is all about Composition and Isolation (see Design Principles, Thinking in React). Meaning that your React components should work on any environment

So, when developing an app, you should focus on developing in isolation, therefore developing with tools like Storybook is actually the only thing you need.

My opinionated developing cycle of a new project:

  1. Decide on any environment (like CRA/Gatsby/Next etc.)
  2. Develop components in isolation (like with Storybook).
  3. Push changed to production environment.
  4. Repeat 1-2 till you get to bottle neck (For example you found that CSR isn't working well for you application).
  5. Switch production environment (remember that your components should work on any environment). Goto 1.

Good Luck.

Dennis Vash
  • 50,196
  • 9
  • 100
  • 118
  • 1
    Thank you for answering, it is really helpful. I don't need Server Side Rendering for this app, so CRA seems to be a good option. I edited my post to be more precise on my worries – Sinane Aug 26 '20 at 12:53
  • 3
    I thought the question was about using `create-react-app` vs doing a react project from scratch. – Fed Apr 12 '21 at 15:20
  • @FedericoCapaldo mentioning the advantages is enough, or you can elaborate? – Dennis Vash Jul 03 '21 at 10:57
  • What's an example of "Hard to configure"? – stk1234 Jul 17 '22 at 17:29
  • @stk1234 Every feature that not supported in CRA is hard to configure, you can reference any tool that helps with CRA configuration like https://github.com/dilanx/craco – Dennis Vash Jul 18 '22 at 11:47
0

For me, the top reason why I won't use CRA is because there is no option for a development / staging build. react-scripts build will always set the environment to production and produce a minified build, not suited to host in a dev / staging environment.

vijayst
  • 20,359
  • 18
  • 69
  • 113
  • 1
    You could just run the standard `npm start` script if you want a dev server (i.e. not production) – Robin Jan 28 '22 at 17:54