When you’re building React applications, small projects can often be a little more flexible than large projects when it comes to code architecture. While there’s nothing really wrong with building a small application following best practices intended for larger applications, it may be unnecessary to apply the big decisions. The smaller the application is, the more it becomes OK to be lazy.
However, the best practices in this article are intended to represent any size React applications.
If you’ve never had experience building an application in production, then this piece will help you prepare for it. The worst thing that could happen to you is building an application at your job, only to realize that you have to refactor large amounts of code to be more scalable and maintainable — especially if you’re missing unit tests!
Trust me. I’ve been there. I’ve been told countless times to complete x by y. At first, I thought everything was going smooth and magnificent. I thought that just because my web application worked and felt fast that I was doing an excellent job developing and maintaining my code. I knew how to use Redux and make the user interface components interact with one another as expected. Reducers and actions were an easy concept for me. I felt invincible.
Until the future crept up.
A couple of months and 15+ features later, things were becoming out of control. My code utilizing Redux was no longer easy to maintain.
“Why?” you may ask.
“Weren’t you invincible?”
Well, I thought so too. It ended up being a ticking time bomb waiting for a disaster to happen. Redux has the amazing ability to keep things maintainable if used correctly in a large-scale project.
Read along to find out what not to do if you’re planning on building scalable React web applications.