This article is not something you might not already know but maybe you might not have it all listed in a one place. There can be more things that I'll surely be missing in this article which I would like you to mention down in the comments so that I can compile another part to this article. And this is a beginner level post.
So let's start on listing the things that I feel one should do before pushing their production build. These are the things that I have used for the react project I have built but they are definitely the points which can surely be helpful in other projects.
1. Clearing all the
console.logs that are absolutely not intended for the users. And it's rare that
console.logs are there for users.
2. Remove all the
commented code which doesn't serves any purpose or in the end is just misleading. Comments are meant for giving extra context to why something has been done not the other way around.
The above screenshot depicts how there is a
useless console logwhich the developer might have used for the
testing purposewhich should be
removedonce everything is wrapped up in development and the project is ready for getting into production.
Another thing worth keeping note is the commented code which serves no purpose in the end.
3. Removing all the
unused npm packages and
libraries that are installed.
4. Deleting all the
unused files that are just clogging up.
It might feel overwhelming to find all the unused packages and files manually but don't you worry.
As the diamond cuts the diamond, in the same way we will use another package to remove the dead files.
5. Check how the build works by
serving the build in react. I know that I used to create a build and then push it to staging server to check how it will behave there because I wasn't aware of the fact that React offers this functionality. It's always good to check your build before pushing it to the server.
So basically this is not about improving the code or optimizing it. These things go hand in hand when you are doing development.
The goal🎯 of this article is primarily on giving the finishing touch to your React Web App before making it live in the production.
I hope this article was helpful to you. I would be more than happy to receive your feedback on this article. Thanks for your precious time reading this. Stay tuned for more insightful reading by me.😊