I have been working with React for a couple of years now and I have seen stupid practices that developers do while working on a React App. In this article, I will list some of these stupid stereotypes and try to explain why they are wrong.
Without wasting time lets start judging😋
- Sometimes people ignore learning JS and rush into React.
- Remember💡, React is a JS library and you have to make sure you are thorough with it. One step at a time does help.
- I would recommend learning these JS concepts and some DOM APIs mentioned in this comprehensive list.
- I have seen a bunch of people using JQuery along with React for DOM manipulations😑.
- It's just pointless, React's main goal is to handle all the DOM changes.
- All you have to do is update the state, render the VDOM and React will take care of all the DOM changes.
- If you used JQuery and React together, then you should expect some bugs that are hard to debug🙈 as both libraries might update DOM elements at the same time.
- Still, If you'd like to continue using JQuery here's a guide integrating it the right way.
- React technically is blazing fast, but everything can become slow if implemented the wrong way😏.
- Think of it, React takes care of all the DOM manipulations. To achieve it, it needs to compare the whole DOM tree and update it, which is a very tedious task🥴.
- The more the number of DOM elements in your App, the slower the APP will be.
- Team React has been doing their part of keeping React performant as possible. React Fiber was a major change!.
- But as a developer you have to do your part right, here's a guide to optimize application performance. 'Avoiding Reconciliation' is one of my favorites🤩.
- These are the guys that just try to get around writing code
- They will use tonnes of component libraries just to get their task done.
- Adding too many packages to your app can increase the overall build size.
- You should keep track of the build size, or else the initial app loading would be slow🐢.
- Webpack bundle analyzer should help you analyze which package you should be ripping off.
- Also external packages are like Magic in your code. Nobody reads how they are working.
- At times they might blow up and you might not understand what happened, KEEP THE MAGIC TO MINUMUM, KNOW YOUR CODE!🤓
- You need to understand that React is a View Library💡.
- How you manage your state is none of its concern.
- I don't suggest Redux to beginners, as the learning curve gets steep.
- There are tonnes of other state management solutions out there, each with their pros and cons.
- Or you can just simply use React hooks and context.
- If you are using GraphQL, I would suggest Apollo. I liked their caching algorithm.
Thank you for reading, I hope you liked this post😄. I'd love to hear your thoughts on this, so please feel free to comment!