10 ms·
This sounds like the complaints from a new developer that's frustrated over the layers of web dev. React does a fantastic job working with common developer pri
by MattDaEskimo 3y ago
This sounds like the complaints from a new developer that's frustrated over the layers of web dev.
React does a fantastic job working with common developer principles such as Don't Repeat Yourself, and Single Source of Truth.
Their points come across as overly vague and lack any true insights into development besides initial impressions.
For a static page it doesn't make sense to use React, obviously. For a highly interactive page it, or another framework is critical to clean, manageable code.
- tauchunfall 3y ago>For a static page it doesn't make sense to use React, obviously JSX is a nice templating language. And when you use Deno or Bun you can use it directly on server-side. My server-side components have no hooks and use preact-render-to-string or `renderToString()` from `react-dom/server`. Also there is Gatsby which is a popular content management system which also allow non-interactive statically rendered pages (as far as I remember).
- benatkin 3y ago> you can use it directly Because of a poor design choice in an otherwise well designed platform (at least in the case of Deno).
- NathanaelRea 3y agoOr Astro, and plugins for React/Tailwindcss/etc. Components are just nice to work with because of their modularity. Using the ergonomics "most web devs" are familiar with is just nice.
- mvdtnz 3y agoJSX is a mediocre templating language that's missing a ton of features from more mature templating languages like Razor
- tauchunfall 3y ago>JSX is a mediocre templating language You can also complain about JSON being a mediocre data format. But I think it's minimalism and compatibility with JS made it successful.
- teaearlgraycold 3y agoI don’t know Razor but I agree. JSX could use an overhaul.
- forgotusername6 3y agoWhat's it missing?
- richeyryan 3y agoI suspect they want better condition handling. Because JavaScript lacks a useful conditional expression beyond ternary expressions, condition handling in JSX generally uses boolean operators or ternary expressions. Suppose the conditional logic is in any way complex. In that case, your choice is to use nested ternary expressions, which can be hard to read or to somehow break the condition out of the JSX using a helper function or separate component so you can use if statements in a regular function context. SolidJS added conditional helpers to its JSX flavour to address this issue[1]. The React team seems ideologically opposed to the idea as it presumably moves JSX away from using only JavaScript for handling logic. [1]https://www.solidjs.com/docs/latest/api#show https://www.solidjs.com/docs/latest/api#show
- tauchunfall 3y ago>I suspect they want better condition handling. Because JavaScript lacks a useful conditional expression beyond ternary expressions, condition handling in JSX generally uses boolean operators or ternary expressions. If a condition in JSX gets too complex I normally extract a component-level function and call it from the JSX part of the component.
- _betty_ 3y agoknowing both i used to be frustrated by jsx's lack of support for plain if and for loops like razor has (eg map and the weird && syntax we general end up with) eg ``` <ul> @foreach(var item in list) { <li>@item.name</li> } </ul> ``` of course this idea goes against jsx's implementation (as it's just nested functions) and paradigm of being html in plain javascript rather than an interpreted templating language. some of the differences i really like (like being able to assign compoents to variables, pretty sure razor doesn't have anything like that).
- mr_toad 3y agoIt actually is quite suitable for static pages where the content itself is quite dynamic (e.g. from a CMS or other database), especially when rendering repetitive data structures (e.g. lists of items). You use React on the server to render the contents on the fly as static html and serve that.
- brianhama 3y agoWhat you are describing falls outside the definition of a static page. At least insofar as I’ve always understood.
- webprofusion 3y agoTrue, but they're not a new developer, so maybe he's just saying what everyone thinks.
- OccamsMirror 3y agoCan confirm the author (not me) has been doing web and system development, including React dev, for over a decade. His complaints are borne of his own frustrations.
- kaba0 3y agoA decade of work experience doesn’t necessarily give them insightful insights. Especially if they don’t even know the core point of the topic at hand.
- wiseowise 3y agoYou’re trying to reduce someone’s 10 years of experience just because they have different opinion than you.
- kaba0 3y agoThey can have whatever opinion they want, but if they fail to grasp the basics of the topic, then that opinion should remain theirs alone.
- d1sxeyes 3y agoWhile I agree in principle that 10 years of experience can also mean '10 years of being a substandard developer in every way', what basics do you feel are missing here?
- lomase 3y agoHackernews became reddit. Sad days.
- treve 3y agoMaybe it's a bit vague or don't have 'true insight', but I would still encourage anyone sharing their feelings, even if they're not expert level insights. React applications turning into a maintenance nightmare and the meta changing under your feet is a common sentiment and I think it's helpful if more people talk about this. One issue in the frontend space is that React has been the default no-questions-asked choice, but my personal vague, no-true-insight feelings are also that you need a technically very proficient team to avoid it turning into a maintenance nightmare. Many people work for SMBs, and it feels like there's not a great golden path currently for frontend. Doing a something simpler somehow feels like a bigger risk to the people I chat with.
- danjac 3y agoI have seen so many React code bases that are the polar opposite to "clean, manageable code" that I would strongly disagree with this premise. That's not to say React is to blame, per se, but good code is the result of good developer practices rather than some framework.
- vjerancrnjak 3y agoA good question is "What is interactive?" Many "interactive" things can be done just with CSS and HTML. * a list of elements you can select and delete/bulk-edit is feasible with <form> * any kind of form with input * hide/show toggle * tabs * accordions Many single page apps aren't really interactive or require minimal JS. Currently, we're doing things in JS (like forms, pages, tabs, virtualized lists & tree views, hovers, even buttons with JS click handlers) just because our server does not render HTML.
- wonnage 3y agoIt’s true that a lot of simple apps could just be written using direct DOM manipulation, but you basically write yourself into a corner. There’s no gradual transition from that to any framework, you just have to rewrite your app Might as well just start with the least common denominator that everyone knows and is easily hired for
- alexanderchr 3y agoYeah especially things like complicated forms can get really hairy if you try to implement them by direct DOM manipulation. Things like fields being shown conditionally based on the value of other fields, data being fetched in the middle of form (depending on field values), stupid complicated validations etc.
- GlenTheEskimo 3y agoI made a paint app with jQuery, and thought it would be a good idea to refactor to React so I could run it on a Next js server and add some multi user support, with later plans of refactoring that to a React native app. Completely painted into a corner, I gave up after about six hours of trying to get my event listeners to work with React. It's a shame, because there's so much server side stuff I could be doing right out of the box with Next, but now I basically need to choose a completely different architecture from the one I want because I thought it would be easier to use jQuery. In all fairness, direct DOM manipulation works a lot better than React for the original app, but now I have to keep DOM state in sync with my server, which is a whole other challenge that React solves quite nicely.
- greenie_beans 3y agolots of folks bash react without actually knowing how to use it.