DEV Community

Rohan Salunke
Rohan Salunke

Posted on

Don't be one of these React Devs🙄

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😋

The one that knows React but not JavaScript:

  • 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.

The one who Uses JQuery with React:

React+JQuery == Pineapple+Pizza

  • 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.

The one who complains that React Apps lag

  • 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🤩.

Mr. LibOverflow😷

Mr. LibOverflow

  • 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!🤓

The one that thinks Redux is must

  • 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!

Discussion (40)

Collapse
macsikora profile image
Pragmatic Maciej

Thanks for the article.

Just one small inconsistency. In last group of point you say:

You need to understand that React is a View Library💡.
How you manage your state is none of its concern.

and

Or you can just simply use React hooks and context.

So in one you are stating that React doesn't care and in second that you have build in tools for that.

React was a lib, and React was dedicated only for the view part. Was, not is, now React is a framework, because you can do fully flavored app only using it (lack of routing is not a point against this statement). Also React has own state management tools, and even React team constantly is saying you should use them, and also constantly saying some critic words about Redux and Mobx.

For other points, React is kinda DSL, so learning only it creates DSL programmers, this means that such kind of developer has problems with understanding the language below React - JS, it can have very bad implications. Like not optimal, or just copy/pasted code. Learning JS should be a rule here.

For using React with JQuery, this is a violation of every principle of React. As React is a way to achieve declarative UI. Where data flow is top-down, and DOM is representing the data. JQuery exactly targets DOM and manipulate it directly, so React loose ability to be declarative too, as JQuery plays a role of Trojan horse.

Collapse
okrohan profile image
Rohan Salunke Author

Thanks for the comment!
I do agree things are seem a bit contradictory for state handling.
It might also seem like React has became more like a framework. But i'd also like point out the fact that, React doesn't forces you to use its state management tools (like a framework might do). I mean it's there, you can use it, but you are still open to try better solutions.

Collapse
monfernape profile image
Usman Khalil

Can't agree anymore

Collapse
adam_cyclones profile image
Adam Crockett

There is nothing wrong with trying to avoid writing code, in fact that's pretty healthy. I agree with the rest, although I am not a react dev.

Collapse
rozenmd profile image
Max Rozen

No code is the best way to write secure and reliable applications. Write nothing; deploy nowhere.

github.com/kelseyhightower/nocode

Collapse
adam_cyclones profile image
Adam Crockett

I am aware of the fantastic work of nocode and vanilla.js, without such effortless work, something would be possible 😂

Collapse
okrohan profile image
Rohan Salunke Author

WTF😂

Thread Thread
adam_cyclones profile image
Adam Crockett

Blank paper tells the best stories

Collapse
anuraghazra profile image
Anurag Hazra

I absolutely agree with you.

Collapse
jasonbunting profile image
Jason Bunting

"KEEP THE MAGIC TO MINUMUM" - are we straining at a gnat but swallowing a camel? I mean, even just using React itself means you're already down the "magic" path quite a ways. When it comes to working in a browser, anything other than basic HTML, CSS and JavaScript is "magic." The lines of demarcation between CSS, HTML and JavaScript are maintained quite a bit more in libraries like jQuery than they are in something like React. I'm not here to hate on React, even though it makes my eyes bleed, I will hate on the idea that there's some proper quantity of magic. If you're going to have a religion, live it? If you're going to use something as black-box as React, you might as well "full send" that shit. ;) Correct me if I'm wrong: at the software level, isn't anything other than ones and zeros an abstraction (read: magic)?

Collapse
okrohan profile image
Rohan Salunke Author

This is the most interesting comment so far! I do agree that there is gonna be some sort of magic in the code, no matter what you work on. But in my opinion and as per my experience building enterprise applications, not quantifying the magic in your code usually blows up. I remember back when we simply imported 'lodash.js' as whole, we considered it as a utility library, but relatively it was HUGE🤯. In a nutshell, all I meant was a: At least a shallow understanding about the magic that your'e supposed to use always helps!

Collapse
kingzamzon profile image
Samson Adesanoye

Now am fully encouraged to learn react. Have been discouraged based on the things have been told about state management e.t.c this post just guide me through.. thanks so much.. #reactweek

Collapse
okrohan profile image
Rohan Salunke Author

I'm glad it helped :) Feel free to connect in case of any doubts learning React/JS linkedin.com/in/rohan-salunke

Collapse
kingzamzon profile image
Samson Adesanoye

Alright thanks alot

Collapse
faraazahmad profile image
Syed Faraaz Ahmad

Thank you for sharing these, it's been an eye opener for real

Collapse
okrohan profile image
Rohan Salunke Author

Thanks!😇

Collapse
gmelidis profile image
Giannis Melidis

Don't be one of these React Devs that call what they don't like "stupid". English language is rich, you could use more appropriate expressions.

Collapse
okrohan profile image
Rohan Salunke Author

The article is much based on facts and not my liking, I've also provided necessary arguments regarding what makes it stupid. Stupid is just stupid, will be stupid, no matter who likes it or not its just Stupid!

Collapse
codelitically_incorrect profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
codelitically_incorrect

The one who thinks React is a framework, when it's really a shitty pair of training wheels

Some comments have been hidden by the post's author - find out more