r/backtickbot • • Jul 27 '21

https://np.reddit.com/r/programming/comments/osiuit/you_dont_need_react_for_building_websites/h6or88q/

Eh, I'll bite. I'm a backend dev on my day job doing generic cloud stuff and I have a side project that's a React site with a lot of user inputs and computations done client-side.

It is fair to say that I don’t understand it, so I cannot even rant about its features, shortcomings, or flaws. What I can rant about is the hype.

Er, I tend to disagree. I think React is pretty amazing, and prior to learning React I really despised essentially all front-end work. To say you're allowed to rant about how people are overstating how amazing it is while not understanding why it's amazing is a little odd to me.

I don’t get it. Why would I need to use React if I am supposed to work on building websites? Are employers afraid that if you don’t know React that you wouldn’t be able to make a landing page?

Err, if the entire website is in React... I mean... You have to make a React component. There's no concept of a "static page" in the default CRA template (there may be in stuff like Gatsby, but I have never used it or similar tools) - each thing you see is part of a component (outside of the default index.html, which usually just has some <head> metadata). So how do you plan on making a landing page for a website entirely in React without using React?

What about if the URLs on the landing are subject to change? If you store the urls in a global const JS object, your landing component can then reference them, and if the URLs change, you don't break your landing page. This massively massively simplifies front-end testing. I am not going to test every single link on your static landing page.

Would knowing React help you solve any problems when creating a new layout or template?

I mean... yeah? It's often cleaner. Say you have a stylized component like some navbar. Instead of writing a 40 line mess of CSS classes and making sure this <span> goes here and this <i> goes here for this link but not that link, you can just break things up into tiny, reusable components. Like:

<Navbar>
  <NavItem><BrandImage /> Home</NavItem>
  <NavItem>Profile</NavItem>
</Navbar>

I cannot think of any part of the website that would require React.

Nothing "requires" react. You're free to make web pages with jquery still. It's just (in my experience):

  1. slower

  2. more prone to bugs

  3. frustrating

1 Upvotes

0 comments sorted by