Which Projects Need React? All Of Them!
Sacha Greif
91836

Future scalability is often used to justify a more complicated tech stack than necessary. Even though I don’t advocate for reinventing the wheel, I do believe that there is a middle ground between vanilla JS and server-rendered React. What about frameworks such as https://github.com/yoshuawuyts/choo or https://github.com/hyperapp/hyperapp or even just https://github.com/maxogden/yo-yo ?

While I was reading your post I was mentally preparing for a reply that would focus on the significant amount of library code that react, react-dom and styled-components would add to your JS bundle. But you then mentioned that you’re rendering everything on the server with next.js or something called Gatsby. So to sum it up: even a simple blog now needs 90kb of parsed JS code for libraries, and to mitigate that, we should introduce server side rendering with additional frameworks?

The complexity and mental overhead your proposed tech stack would add to a small project (especially considering that this is the FreeCodeCamp medium channel) is enormous. It would probably mean that the average aspiring frontend dev here on FreeCodeCamp would need a lot more time to complete any given project and end up with less confidence in the code they wrote, because there are just so many (more) moving parts.

To beginners like me it is often unfortunate that so little attention is paid to bundle size and keeping things simple. By that I don’t mean the usual “Javascript is too complicated” complaints — I love ES6/7, bundlers, flow-typed, redux, prettierJS, eslint, npm/yarn, and all these things — but rather that especially beginner JS developers should be very careful when it comes to adding yet another library to their project. Server side rendering has its use cases, but mitigating your unnecessarily large bundle size should not be one of them. If you really need these libraries because your frontend is complex, then all power to you. I think styled-components is actually a good example: https://github.com/styled-components/styled-components/issues/748. If your app has a couple KB of css, this is definitely overkill.

If you really want to stay in the react ecosystem (which is definitely a great reason to use react, I’d mention that), you could also consider something like https://github.com/developit/preact.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.