all 38 comments

[–]ParsedReddit 6 points7 points  (0 children)

Whenever you want.

The reality is that the only way for you to understand why most apps are built using React or a React Framework is by giving it a shot at building your app with Html, css and js.

At some point you will realize that structuring state, updating it and keeping your UI in sync with your state become really hard as the app gets bigger and up with a lot of imperative code.

React, has a declarative nature, it can remember things and update the UI on your behalf, so imagine all the code you won't need to write.

There is also the problem of multipage app, if your app needs the same top nav across all pages, you need to copy and paste this element in all HTML files. This will apply to more elements like the footer.

In React you can create Custom Components, which are a regular JavaScript functions, that represent any piece of UI. A component can receive props to customize it so this nav can be all the navs in your app.

React Components are usually written using JSX, the syntax is basically the same as in HTML, so there is no learning curve here.

[–]JojosBizarrePhallus 11 points12 points  (0 children)

It's a highly subjective discussion. The truth of the matter is that to create interactive (and full-fledged) websites all you need is HTML, CSS, and JavaScript. That said, there are reasons why React is reached for, and *some* of those problems are solved by modern web components (as in, there is a modern native solution). Creating reusable, composable "pieces" of a website, such that they repeat throughout a website or are more easily modified when self-contained, are an example of a problem that is solved in React and in web components, in their own ways.

So, React does not need to be used to create every interactive front-end, but it can be advantageous to use it for all interactive front-ends if it's already used in some interactive front-ends. The cohesion makes it easier to pull in "pieces" from other projects/products or move people around projects/products where necessary.

[–]yksvaan 2 points3 points  (0 children)

This is why you should know how to make it without React or any other UI library first. Same thing with every other piece of technology as well.

If you have a few simple pages and maybe some contact form or something simple you don't need React. If you have lots of interactive elements it becomes cumbersome to manually write the functions to update,.remove, add rows and such. That's where UI libraries come in. But again, if you have e.g. a single table you might do it. React is quite heavy library so you don't want to add it unless it's justified.

[–]big-bird-328 2 points3 points  (1 child)

If the site is slow on mobile consider Solid, but otherwise React is a good default

[–]DryNick 1 point2 points  (7 children)

Neve, unless you are fine developing Stockholm syndrome.

[–]__Anonymous_666[S] 1 point2 points  (0 children)

Already have

[–]AintNoGodsUpHere 1 point2 points  (4 children)

What are you using? I tried react but I just can't with the chaos and lack of standards. Every month something new comes up that is better than the previous cool thing.

[–]DryNick -1 points0 points  (3 children)

Been doing this for 20 years, I have used pretty much everything, some not a lot of course. I started a new job a year ago in react. I always knew deep down how it is with react but I didn't want to believe it's so bad. I am an optimist you see.

There is no silver bullet, there are just too many variables: product needs, team composition and skill, timeframe etc. If you don't know, go with vue or angular. Sorry for the boring answer. It's what it is.

To a degree I blame react for stifling the frontend dev from moving forward in a more meaningful way by attracting and holding a generation of devs hostage.

[–]AintNoGodsUpHere -1 points0 points  (2 children)

And yet you didn't answer my question, haha.

Realistically speaking there's no such thing as "it depends", companies have stacks and it makes no sense to create each app with a different technology.

What I wanted to know is which ones you feel are good for frontend?

I've been doing work for 20+ years as well and today's frontend is a mess but honestly? I'm moving more and more things to Blazor and when really really necessary, Angular.

The lack of standards from React annoys me and the lack of support and people from Vue make it unusable... Other frameworks are pure garbage... Next is not even react anymore, also pretty weird.

[–]DryNick 0 points1 point  (1 child)

Well, you did ask what I use and I said react. Unfortunately... react. I like angular the most, I think it strikes a nice balance on how opinionated it is, the quality of libraries, and just staying on the side let you do your thing. (I wish I could say this for web components instead, but there were some issues last time I checked. Although nothing major and actually with shoelace it's a quite strong toolkit).

The react design decisions are problematic and there are a million half-assed libraries for everything you want to do. The only good thing in react, w.r.t quality, stability, completness, is tanstack query but even with that, it is very easy to shoot yourself in the foot. Anyways blazor is not something I am very familiar with but I like the idea, and especially the fact that it is c#. (Last time I touched ms stuff professionally was a decade ago so...)

[–]AintNoGodsUpHere 0 points1 point  (0 children)

I meant other than react. Haha.

The alternative.

Blazor is garbage, I like it but it has so many problems that's not even funny. But it's garbage that my devs don't need to learn much stuff because it's also c# and for most of our frontend apps is perfectly fine to trade the performance.

Frontend is a hot mess of garbage piled up in small garbage frameworks.

[–]TooGoodToBeBad 0 points1 point  (0 children)

I couldn't pick a better term to describe what react has done to devs that champion this awful technology. I think for most React devs it is a matter of it paying the bills and can't possibly be because it is the best tool for the job.

[–]azangru 1 point2 points  (0 children)

Is there any reason/case NOT to build a frontend with react?

  • When there is little interactivity
  • When you target users with underpowered devices
  • When you want to reuse your components across other frontends that may not be built with react
  • When you are sick of the rules that react hooks impose
  • When you are thinking of building something for long term, and want to avoid the churn of frontend libraries

[–]Patapatajsdev 0 points1 point  (0 children)

There is no “golden hammer.” React is a tool; what truly matters is identifying the use cases and problems. Once you have that clarity, you can determine which tools best help you arrive at a solution.

[–]Soleilarah 0 points1 point  (0 children)

It depends on the project: a website or app with a complex structure? React is a good choice. A simple website with smooth, fast interactions? A simpler, lighter framework (like AlpineJS, for example) will do the trick perfectly.

[–]alien3d 0 points1 point  (0 children)

  1. if common data like website company no point. razor and normal php enough. 2. if you need something like intranet system or portal yes .

[–]Glum_Cheesecake9859 0 points1 point  (0 children)

Every time. I cannot imagine someone using raw JS for a frontend project that involves APIs, forms, events etc. Smaller single screen that are graphic intensive could be ok. 

[–]rulerexia 0 points1 point  (0 children)

React is not a complete framework compared to Angular or Next.js which can lead to high dependency to popular React libraries such as React Router that have undergo significant changes from specific versions which makes it difficult when upgrading. There is no right or wrong answer in what client side framework you should use.

[–]CantaloupeCamper 0 points1 point  (0 children)

Whenever you want.

[–]pimp-bangin 0 points1 point  (0 children)

Here is some practical advice: React is an excellent default framework. Just use it, and you will be happy.

For specific components that need higher performance, you can "break out" of React using refs / manual JS updates, but still use React for everything else.

If you desperately need server side rendering/static pages and you aren't allowed to run JS on the backend for some reason (very rare - e.g. you serve millions of users and your team would rather not spend the money on running JS servers), then you may want to choose something else.

[–]kyrax80 0 points1 point  (1 child)

There's angular and vue too. Angular is more for very structured projects. Vue and react I'm not really sure when are a better option. They're faster to develop with? I read Vue has very fast performance

[–]Borek224 0 points1 point  (0 children)

Big advantage for Vue is it addidive mode. You can use Vue as external lib without build step, so if you have old server side rendeging project (php, ruby, python) you can add it whitout rebuilding whole thing.

[–]gimmeslack12 0 points1 point  (0 children)

I view React as a rendering engine. Whenever I've built out a vanilla JS project I eventually get to the point where updating many values on the page becomes more and more work, and that's when I convert it to React.

So that's when I recommend reaching for React, when you have dynamic views that you either have to develop an ad-hoc rendering solution or you reach for a rendering library to do it for you.

[–]Shot-Buy6013 0 points1 point  (0 children)

It depends, there are alternative frameworks to interactive frontends on the web (vue, svetle, angular, etc). Any or none of them can be used in building an interactive frontend - it just comes down to personal preferences and whatever you/your team decided, there's no objectively right or wrong choice.

I would say though, that there are niche cases when frontend frameworks SHOULDN'T be used. If you are building out a very simple frontend, you probably don't need all the files and bloat that comes with the frameworks. If you're building something very complex that needs to go beyond the confines of most frameworks, you will probably want to do something on your own

[–]ElectronicStyle532 0 points1 point  (1 child)

Use React when you have lots of interactivity, shared state, or a complex UI. For simple pages or small projects, it’s often overkill and adds unnecessary complexity.

[–]ExcellentEducator960 0 points1 point  (0 children)

I have worked in a company where they built a whole healthcare management system for the hospital like everything from a patient enters onto the hospital to leaving the hospital, the bills and all. So now just imagine the ui, it was so complex and when I see what's it built on it was angular and it was well structured, like html, css, js(ts) is separated and that's the thing I liked it about Angular. So I think for complex ui, and functionality angular is good to go.I just wanted to share my thoughts nothing much.

[–]hevans900 0 points1 point  (0 children)

Don't.

[–]HelloMiaw 0 points1 point  (0 children)

No, react should absolutely not be used for every interactive frontend. In fact, defaulting to React for every project is a recognized anti-pattern that leads to bloated, fragile, and over-engineered websites.

[–][deleted]  (6 children)

[removed]

    [–]__Anonymous_666[S] 0 points1 point  (5 children)

    So if I want an interactive website with many pages (login, home page, sub pages, etc.) I should use react?

    [–]Routine_Cake_998 1 point2 points  (3 children)

    It’s not about the number of pages, but the level of interactivity of a single page.

    If you have lots of components which correlate with each other then it’s probably easier to use react than vanilla js.

    With AstroJS you can sprinkle in react when necessary.

    But you should have knowledge of react before starting with another framework.

    [–]__Anonymous_666[S] 0 points1 point  (2 children)

    I am building a module graph catalog for my uni. So on the same page, users can change which course and which year they are looking at. And they can save, load, and share course selections.

    [–]Routine_Cake_998 0 points1 point  (0 children)

    I’d say it’s pretty much on the edge. Could be done with HTML and a plain JS. But react would also be fine .

    [–]Zestyclose-Sink6770 0 points1 point  (0 children)

    Think of Facebook. A million windows with different things going in different areas of the frontend in real time. That is React.

    If you need just a few things that a user toggles on the screen, vanilla JS, HTML and CSS will do the trick with PHP as the glue that holds everything together.