News for hackers. Stuff that matters.
Re:Things I wish I knew about state management when I starte... by jfengel on Monday February 10, 2020 @01:23PM (#22291733)
React and Redux are for apps. If you can do it with HTML/CSS, you absolutely should.

React/Redux are a replacement for what people used to do with jquery or plain JS. They're not for display; they're for complex interaction of the kind that used to require a native user interface (Java Swing, Gtk, Win32, etc). Javascript is a mess, and the DOM is a mess; React makes that slightly less awful. (Redux is an extension to React to help manage global state; again, it's compensating for just how bad Javascript is.)

Bonus: React encourages the use of JSX, a language that makes a lot of behavior look as if you were writing it directly in HTML. You don't need React to use JSX, and you don't need JSX to use React, but they do dovetail nicely.

You can write in plain JS/jquery if you want. Plenty of people do. React is a framework to make that a bit easier; that's all.

Re:Things I wish I knew about state management when I starte... by lhorie on Monday February 10, 2020 @04:05PM (#22293328)
I think what GP was getting at is that there's a healthy amount of "if all you have is a hammer" mentality going on w/ React/Redux. The tragedy of commons here is that you _could_ conceivably just slap a class at the root of your React tree to implement dark mode, but if one is using something like styled-components, there's a good chance that the library will get in the way of the style cascading semantics that come for free w/ the browser. And ultimately, the end-user is the one paying the price for all the extra code needed to make a "complexity-friendly" implementation of dark mode work.

Another observation that I've been finding interesting about "modern frontend development" is that despite all the arguments about how React makes DOM manipulation easier, people still prefer to defer to libraries to do any non-trivial amount of DOM manipulation rather than actually use pure React to do it. This is exactly the same modus operandi as when jQuery was "modern frontend development" ("it makes it easier to work w/ DOM", plus a ton of opaque jquery-* libs)

Re:Things I wish I knew about state management when I starte... by westoncb on Monday February 10, 2020 @07:04PM (#22294759)
> people still prefer to defer to libraries to do any non-trivial amount of DOM manipulation rather than actually use pure React to do it.

Could you give an example of a commonly-used library that serves this purpose?

Re:Things I wish I knew about state management when I starte... by lhorie on Monday February 10, 2020 @10:52PM (#22295893)
Add a word after "react-" and there's a good chance it's one. React-bootstrap (vs bootstrap), react-dnd (vs something like dragula), etc.
Re:Things I wish I knew about state management when I starte... by acemarke on Monday February 10, 2020 @11:03PM (#22295940)
I'm not sure what point you're trying to make here.

Both of those examples are _specifically_ about using React to do the actual DOM manipulation.

React-Bootstrap is a set of React components that know how to generate the correct HTML structure and classnames to get the matching Bootstrap styles. As part of that, I believe some of the jQuery-centric logic in Bootstrap has been implemented in just React.

For drag and drop especially, you're having to approach the problem from a different mental model. You can't just `$(".my-list").sortable()`. React wants you to describe your UI based on _state_ rather than doing raw DOM manipulation, so libraries like react-dnd and react-beautiful-dnd do the work to tie together drag events with the underlying logic to drive React re-rendering.

But in both these cases, you're not "using other libraries to do DOM manipulation". React's doing the work. These libraries are just helping tell React what the DOM should be.

Re:Things I wish I knew about state management when I starte... by lhorie on Tuesday February 11, 2020 @12:03AM (#22296214)
This is why I was reluctant to give examples (because as soon I did, someone was bound to say something along the lines of "well these leverage react in a very react specific way so of course it makes sense they're react things")

The thing is that we could s/react/jquery/ and end up with a more-or-less believable argument for why "jquery is needed for complex apps": You can't just `draggable=true`. jQuery wants you to describe your UI in terms of a plugin's options object rather than doing raw DOM manipulation; libraries like jquery-ui do the work to tie together drag events with underlying logic (e.g. snap) to drive jQuery re-rendering. You're not "using other libraries to do DOM manipulation"; jQuery's doing the work. Etc.

Of course a library on top of react/jquery/whatever will generally be written in a way that is idiomatic for code written on top of its respective base framework. For library writers like you and me, it might even make sense to argue that React rendering model is nicer for writing libraries on top of than jQuery. But that's a developer-oriented mindset, which, as the_gastropod had alluded to, it's very often at odds w/ a user-oriented mindset.

The "old beard" approach slices through all the abstraction layers and simply points out: huh, you don't need context and css-in-js and themes to do dark mode, plain CSS fits the bill. And when one resets assumptions enough times and start noticing more often than not that "complex" projects turn out to be glorified CRUD apps, one might indeed start to wonder if the abstractions are really as fitting for the task at hand as they should be.

Re:Things I wish I knew about state management when I starte... by shadowgovt on Monday February 10, 2020 @04:33PM (#22293627)
I don't see why using libraries for complicated interactions atop React is a bad thing.
Re:Things I wish I knew about state management when I starte... by johnmaguire2013 on Monday February 10, 2020 @05:23PM (#22294063)
I'm not sure it's a bad thing - but using a library for DOM manipulation on top of it diminishes the argument that React's advantage is to make DOM manipulation easy.
Re:Things I wish I knew about state management when I starte... by dragonsh on Monday February 10, 2020 @09:15PM (#22295392)
Having used react and modern web components to build webpages. I will agree with the first comment which says what is made so hard by react/redux can be easily done if the pages were rendered on server and delivered to client with progressive smaller bits of JavaScript for dynamic interaction.

If state management is so critical to running a react app than I feel Elm/ClojureScript is a better choice than react to build web apps. But I doubt they will be as popular given network effect.

Now everyone went on a bandwagon that react/angular/SPA/progressive apps is the only future and plain HTML/CSS/JS mix on server side with specific language templates is dead. I am sure we will again go full circle back as you can see now with SSR (server side rendering) is considered as a norm for performant react or angular apps. SSR combined with complexity of react/redux unnecessarily makes everything complicated (worse than even complex). Instead of doing HTML templates in nicer language on server side now people are forced with half baked solution on client side like JSX or angular templates etc.

A developer not just need to learn intricacies of HTML/CSS/JS, but then API's of framework like react, combine it with state management framework, combine it with client side templates, combine it with build tools like gulp, webpack, combine it with NPM, Yarn, combine it with babel compiler, combine it with many testing frameworks. The whole eco-system is very complicated (not just complex).

This is one of the reason for emergence of compiler based web application development language and frameworks like Svelte, Elm, ClojureScript, PureScripts. They will still be not popular because there is a network effect of jobs available. So inferior tools for user interface like react/angular will continue to thrive.

Re:Things I wish I knew about state management when I starte... by littlecranky67 on Tuesday February 11, 2020 @05:31AM (#22297426)
> Now everyone went on a bandwagon that react/angular/SPA/progressive apps is the only future and plain HTML/CSS/JS mix on server side with specific language templates is dead

Well it is not dead, but with the rise of Webapps (not Websites!) come use-cases you can only handle with SPAs. One major example is the new youtube feature, where the video playback is not interrupted when you click on a link somewhere (the video stays at the right bottom corner of the page and keeps plaing). No way to do this with SSR.

Other examples include staying in fullscreen mode (think automatic playback of video playlists) - with SSR, every video change would trigger a page reload and thus require user interaction to go back to fullscreen.

SPAs are not required for Websites, but for Webapps there are a lot of cases where SSR is not possible or would result in poor UX.

Re:Things I wish I knew about state management when I starte... by dragonwriter on Tuesday February 11, 2020 @09:40AM (#22298808)
> The tragedy of commons here is that you _could_ conceivably just slap a class at the root of your React tree to implement dark mode, but if one is using something like styled-components, there's a good chance that the library will get in the way of the style cascading semantics that come for free w/ the browser.

A decent dark mode is going to take a lot than a class at the root in any case (a class at the root makes a good toggle, sure, but you have to do all the styling if particular elements that that toggle applies.)

If you have handrolled CSS for your light theme and want to add a dark theme toggle, hand rolling CSS for it and toggling with a class at the root is pretty idiomatic React.

If you've chosen a styling/theming library to solve other problems, or incidentally to doing so as might have happened if you chose Material-UI, then, sure, a class at the root might not work well, and/or you might have a much easier solution (not easier than the class at root but easier than the rest of the work of implementing a dark theme) for adding a toggleable dark theme. Like in Material-UI, where you just tell the theming solution you’d like the computed dark version of a theme.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Monday February 10, 2020 @01:44PM (#22291937)
I actually write a good bit of React professionally. I'm familiar. I just have yet to see a very compelling case. And the excuse is almost always this nebulous "rich/complex interaction". And.... I just rarely see any good examples of this. The huge majority of apps (web or otherwise) are not video games. They're forms that submit stuff to a server and get a response. There's sometimes a dropdown here or there.... and that's it.
Re:Things I wish I knew about state management when I starte... by nepeckman on Monday February 10, 2020 @02:37PM (#22292421)
I see this sentiment on hacker news a lot, and I honestly dont get it. A list of functionality I've implemented that requires (or is made easier by) JavaScript: Client side validation, error messages, autocomplete, dynamically picking/removing/auto filling fields based on user input, forms that need to know user answers to previous forms, smart tables, update of data pushed from server, sharing markup/functionality between pages, removing markup when no longer needed, adding markup when relevant, etc.

Of course, all of the above functionality can (and has been) implemented in jQuery, or vanilla js. But using a framework makes it easier to structure and edit the project.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Monday February 10, 2020 @04:44PM (#22293717)
> Client side validation

The server still needs to validate, no? I've never seen a form that really benefitted from client-side validation. As long as required fields are clearly marked, I don't really understand the value here.

> error messages

Hmm? What about them needs React?

> update of data pushed from server

You can poll very cheaply. And even Websockets are pretty simple. Check out Phoenix LiveView or Rails Action Cable for decent examples of trivial solutions to this.

> sharing markup/functionality between pages

Even Apache server-side includes let you do this. We're not talking about hand-rolling plain HTML files in MS notepad (or even going wholly js-free). We're talking about React being overkill in a lot of places.

Re:Things I wish I knew about state management when I starte... by johnmaguire2013 on Monday February 10, 2020 @05:25PM (#22294080)
> I've never seen a form that really benefitted from client-side validation. As long as required fields are clearly marked, I don't really understand the value here.

Required fields are typically not the only type of validation required by a form. I think a designer would see the value of client-side validation more easily than a developer. It's not to ensure correctness - it's to give the user quick and actionable feedback.

> You can poll very cheaply. And even Websockets are pretty simple. Check out Phoenix LiveView or Rails Action Cable for decent examples of trivial solutions to this.

React isn't helping you poll - it's helping you structure your application in a way that ensures all components receive the updated data.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Monday February 10, 2020 @05:48PM (#22294257)
> it's to give the user quick and actionable feedback.

Right.. But I think often times the difference is pretty overblown. Clicking "save" and getting that feedback in ~100ms is not, in my estimation, worth the massive extra overhead of using a front-end framework, duplicating your validation requirements, etc. If you're google or facebook or youtube or are otherwise printing money, go for it. But for the 99% of web apps out there, I think this is a bad trade.

> React isn't helping you poll - it's helping you structure your application in a way that ensures all components receive the updated data

Right.. But so is just re-loading (most of) the page from the server. Again, e.g., Phoenix Live View or Action Cable style.

Re:Things I wish I knew about state management when I starte... by nohuhu on Monday February 10, 2020 @06:12PM (#22294432)
> Clicking "save" and getting that feedback in ~100ms is not, in my estimation, worth the massive extra overhead of using a front-end framework, duplicating your validation requirements, etc.

Is it worth spending more developer time (think $$) on optimizing things for imaginary savings on initial page load time?

> Right.. But so is just re-loading (most of) the page from the server. Again, e.g., Phoenix Live View or Action Cable style.

How is that less complex than a client side application? You are essentially advocating for splitting the logic between server and client side. Of course that is possible and people do that all the time for various reasons. Does not mean that's the best way of doing things.

I think you are missing the elephant in the room. Emergence of the front end development frameworks like React was caused by ever increasing complexity of the front end applications. Which, in turn, is driven by customer demand. Customers pay for features, not for code quality, and churning out features is much easier and quicker using React vs. e.g. jQuery.

Lamenting front end application overhead is the same as lamenting using high level languages for back end services. Everybody knows that Real Programmers wrote Real Programs in assembler back in the olden days!

Re:Things I wish I knew about state management when I starte... by jfarmer on Monday February 10, 2020 @06:52PM (#22294680)
I'm with you on the fact that React is overused, but:

> in ~100ms is not, in my estimation, worth the massive extra overhead of using a front-end framework

The phenomenon of change blindness means a 100ms "blank screen" can be the difference between the user recognizing the fact that they've made an error and getting frustrated because they can't tell where the error is. The 100ms reload means if you don't want that to happen, you have to be much more careful about how you design your errors.

It's an easier design problem if the user sees the error appear immediately where their attention is already focused.

https://www.youtube.com/watch?v=bh_9XFzbWV8

I'd argue caring about this is more important for a smaller product where the marginal cost of a single user churning is (probably) much higher.

Re:Things I wish I knew about state management when I starte... by ncallaway on Monday February 10, 2020 @11:51PM (#22296156)
> Right.. But I think often times the difference is pretty overblown. Clicking "save" and getting that feedback in ~100ms is not

Let's say the form has 5 fields, and I as the user make an error in the first field.

Why do I have to finish filling out the entire form to hit "save", to discover I made an error in the first field? That's not a difference of ~100ms, that's a difference of several seconds (or tens of seconds for a medium-complexity form).

Re:Things I wish I knew about state management when I starte... by flukus on Tuesday February 11, 2020 @12:08AM (#22296232)
>Why do I have to finish filling out the entire form to hit "save", to discover I made an error in the first field?

Because more validation will usually happen on the server side anyway and finding out when you hit save creates less interruptions to your flow. There's no tabbing back to re-enter a field, there's no thinking it's fine only for the server side validation to reject it and there's no nagging when I skip a field to come back to it later, there's no UI jumping around when the error is shown. Client side validation takes a stateless form and interrupts me with it's stateful validation. At best it's an interruption, all too often there are silly things like not letting you tab to the next field or warning you that the second password you haven't yet entered doesn't match (and then later telling you about other problems when the backend does the validation).

Not to mention it's easier, whether you agree or not with "developers are expensive so performance doesn't matter" in a world where this is often said I'd expect more server side only validation because client side validation is duplicating the work.

I don't think client side validation is necessarily bad, but most implementations get in my way more than the server side equivalent.

Re:Things I wish I knew about state management when I starte... by ncallaway on Tuesday February 11, 2020 @12:36AM (#22296348)
> all too often there are silly things like not letting you tab to the next field

Well, that's a criminal use of client-side validation, but it shouldn't condemn all client-side validation.

> Not to mention it's easier, whether you agree or not with "developers are expensive so performance doesn't matter" in a world where this is often said I'd expect more server side only validation because client side validation is duplicating the work.

That's fair, but as others have noted if you're in a world where a polished user-experience really makes a difference or is a competitive advantage I'd argue that well executed client-side validation can get you to a UX-quality bar that no amount of server-side validation can reach (edit to add: server-side validation is still, of course, absolutely required).

Whether that's truly important for a given business or product can only be argued on a case-by-case basis. I think it's definitely a colorable argument that there's some overuse of client-side validation relative to product goals, but I think there are definitely places where client-side validation is hugely impactful.

Again, all of this assumes that the client-side validation is implemented at a high quality bar. Of course bad client-side validation is not useful.

Re:Things I wish I knew about state management when I starte... by wilsonrocks on Tuesday February 11, 2020 @01:56AM (#22296632)
There is definitely a happy middle ground. Feedback too soon can be jarring, but waiting till the end of a form can be very frustrating, especially if there are many fields and you have to reparse to find the error. I think you need both to have a good experience.
Re:Things I wish I knew about state management when I starte... by ncallaway on Tuesday February 11, 2020 @09:34AM (#22298754)
Oh, I agree.

I just think that, if you're aiming for the highest UX-bar, you're going to need client-side validation at some point. For any mildly complex form, server-side validation will usually be far past the sweet-spot you're referring to.

Now, as others have mentioned, it might be questionable whether every web-app and website should be targeting the highest UX-bar.

Re:Things I wish I knew about state management when I starte... by imtringued on Monday February 10, 2020 @08:03PM (#22295077)
By the time the user presses the save button more than 100ms have passed and the user probably has filled in 10 other fields. You can avoid this frustration with a little bit of Javascript.
Re:Things I wish I knew about state management when I starte... by nepeckman on Monday February 10, 2020 @05:47PM (#22294249)
> The server still needs to validate, no? I've never seen a form that really benefitted from client-side validation. As long as required fields are clearly marked, I don't really understand the value here.

Any non trivial form is going to have non trivial validation. Validity for some fields will depend on other fields, the validity for a single field could have complex rules, and forms can be lengthy. It helps the user to get validity feedback without sending information back and forth from the server.

> Hmm? What about them needs React?

> You can poll very cheaply. And even Websockets are pretty simple. Check out Phoenix LiveView or Rails Action Cable for decent examples of trivial solutions to this.

Like I said in my OP, none of the things I listed require React, some dont even require JS. But having worked in large codebases of jQuery and large codebases of framework code, frameworks scale up better. LiveView is cool tech though.

> Even Apache server-side includes let you do this. We're not talking about hand-rolling plain HTML files in MS notepad (or even going wholly js-free). We're talking about React being overkill in a lot of places.

If you need to share markup with dynamic values, you need a full programming language. I'm aware that there are many solutions for sharing markup, but there are fewer solutions for sharing markup with dynamic behavior. Again, a framework scales up better.

To be clear, I'm not suggesting React for everything. But the GP comment was suggesting it was good for nothing, so I provided counter examples.

Re:Things I wish I knew about state management when I starte... by nohuhu on Monday February 10, 2020 @06:00PM (#22294359)
> The server still needs to validate, no?

Client input should never be trusted. Server needs to validate, but that doesn't mean client shouldn't validate as well.

> I've never seen a form that really benefitted from client-side validation. As long as required fields are clearly marked, I don't really understand the value here.

Client side validation is not only about required fields, it's much more than that. Have you ever used a web store where you need to enter your shipping address, credit card info, etc? Address, zip code (or worse, UK style postal code), phone number, email, credit card number - all that needs to be validated.

Sure the server can (and should) validate that. The problem then is how to let the user know they've made a mistake and how to fix it. Accessibility issues aside, users need to be told that they've made a mistake as soon as it is made, otherwise there is a chance they won't find the error message, and simply give up trying. Lost sales is the reason client side validation was invented.

> Hmm? What about them needs React?

If you don't want to submit a form with full page reload, you need to make an Ajax call with form info. When response comes back with a list of errors, you need to walk through the fields on the page and mark the relevant ones as invalid, with corresponding error messages displayed _close_ to the input fields. Of course that is doable in plain JavaScript, and doing that seems trivial for one form. Then you have to duplicate that code for another form, or abstract it in a library... Congrats, you're on your way to reinventing React. Or worse yet, Angular.

> You can poll very cheaply. And even Websockets are pretty simple.

When the results of that poll come back, you need a way to display them. You need to decide which part goes where, which elements to hide and which to create, etc. The mechanics of this is what React (or a similar library) does for you, so that you could concentrate on writing logic instead.

> We're talking about React being overkill in a lot of places.

React might be overkill in a lot of places, but it's extremely hard to tell where and when. If you start with a simple hand rolled JavaScript app, at some point you might realize that maintaining it is a chore beyond one person's capacity, and hiring someone to do that for you is plainly impossible. You should have started with (React|Angular|Vue|whatever) in the first place, and now it's a choice between ground up rewrite in (React|Angular|Vue|whatever), or long stagnation and eventual death of your business. Do you want to take that chance?

Optimizing for developer productivity is the only safe bet in the majority of cases, unless we're talking about a personal project with no commercial value.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Monday February 10, 2020 @06:10PM (#22294419)
> Client side validation is not only about required fields, it's much more than that. Have you ever used a web store where you need to enter your shipping address, credit card info, etc? Address, zip code (or worse, UK style postal code), phone number, email, credit card number - all that needs to be validated.

A couple points:

1. The ~100ms between submitting a form and getting error messages isn't that big of a hurdle, in my experience.

2. HTML5 has validation attributes for forms, which can handle every one of your examples.

> If you don't want to submit a form with full page reload, you need to make an Ajax call with form info. When response comes back with a list of errors, you need to walk through the fields on the page and mark the relevant ones as invalid, with corresponding error messages displayed _close_ to the input fields. Of course that is doable in plain JavaScript, and doing that seems trivial for one form. Then you have to duplicate that code for another form, or abstract it in a library... Congrats, you're on your way to reinventing React. Or worse yet, Angular.

Negative. You can do an ajax call, and re-render part of the page (e.g., the entire <body> pjax-style). This is fast, doesn't cause the "flash" of a page reload, and doesn't require more than a few lines of js to setup.

> When the results of that poll come back, you need a way to display them. You need to decide which part goes where, which elements to hide and which to create, etc. The mechanics of this is what React (or a similar library) does for you, so that you could concentrate on writing logic instead.

Again, turbolinks on pjax has solved this problem very well. Just re-draw the bulk of the page. All the simplicity of reloading the page with none of the user pains of actually reloading the page.

> Optimizing for developer productivity is the only safe bet in the majority of cases, unless we're talking about a personal project with no commercial value.

I agree. But I don't agree React _benefits_ developer productivity. On the contrary, I think it (and its competitor frameworks) are responsible for a lot of wasted developer time and frustration.

Re:Things I wish I knew about state management when I starte... by dragonwriter on Tuesday February 11, 2020 @10:24AM (#22299148)
> The ~100ms between submitting a form and getting error messages isn't that big of a hurdle, in my experience

Sure, it's the >100ms between the user entering the first value that might have an error and the user submitting the form that's a much bigger problem between validate-on-server-on-submit and validate-on-client-on-entry.

> But I don't agree React _benefits_ developer productivity. On the contrary, I think it (and its competitor frameworks) are responsible for a lot of wasted developer time and frustration.

After a not-very-long familiarization period, developers seem to be more productive with React (or probably Angular.) I know I am, and I've been using SPA frameworks (mostly React) for a short time after having done web lots of other ways for a very long time.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Tuesday February 11, 2020 @10:45AM (#22299341)
I've been professionally working on SPAs for the past 7 years. I'm familiar. I strongly disagree with the premise that it's in any way more productive. I'm, at a minimum, 2x more productive building something the traditional "Rails way" with server-rendered HTML, and a handful of JS enhancements where necessary vs doing a full-blown SPA. I'd love to do a showdown, and challenge anyone to a head-to-head non-trivial app build-off to put these competing notions to the test.
Re:Things I wish I knew about state management when I starte... by nohuhu on Wednesday February 12, 2020 @01:23PM (#22311250)
Everybody is different. You might be more productive at doing stuff the "Rails way", somebody else might not be. I know I won't be, simply because I don't know Ruby and/or Rails enough to be productive in it.

Not every organization can use this approach either. E.g. I work at a True Java Shop(tm), where voicing the idea of using Ruby for a back end service would get me laughed out of the room with a permanent label of That Funny Guy Who Likes Toy Languages.

Using React for a front end client application that consumes back end API built in Java is 10x more productive than doing the traditional "Java Way" application with server-rendered HTML.

Re:Things I wish I knew about state management when I starte... by nohuhu on Monday February 10, 2020 @07:28PM (#22294891)
> The ~100ms between submitting a form and getting error messages isn't that big of a hurdle, in my experience.

The issue here is not the length of time it takes for the response to come back, rather the fact that there is any delay at all. Client side validation code can be synchronous, submitting any validation info to the server makes it asynchronous by definition. State synchronization between client and server is a big enough problem as is, there is no need to add to it.

Consider this scenario: you have typed an email into a field, tabbed to the next field and realized that you made a typo. Our client sent a validation request to the server, and meanwhile you shift-tabbed back and corrected the typo. The server response came back with invalid indication for the already outdated state, what do you do?

This kind of issue is happening in real life a lot more often than you might think.

> HTML5 has validation attributes for forms, which can handle every one of your examples.

There is no input type for credit card number but there is a very basic and easy to implement algorithm that checks the credit card number validity. This alone is worth implementing client side validation, if your application has to handle payments in any form.

> Negative. You can do an ajax call, and re-render part of the page (e.g., the entire <body> pjax-style). This is fast, doesn't cause the "flash" of a page reload, and doesn't require more than a few lines of js to setup.

Double negative. Re-rendering part of the page received via Ajax call obliterates the current state of that page, or worse yet, a part of the page. User started typing and the page reloaded, all their input - and even which field was focused - is lost. This is a very undesirable user experience.

> Again, turbolinks on pjax has solved this problem very well. Just re-draw the bulk of the page. All the simplicity of reloading the page with none of the user pains of actually reloading the page.

It's actually vice versa: all of the pain of actually reloading the page with no real benefit whatsoever. If you are going to reload the bulk of the page, might as well reload the whole page, just to have consistent state. But that brings us to square one: why having all this complexity in the first place? Because we want user interaction to be smooth, quick, and painless. This implies eliminating roundtrip delay, however small it is.

100 milliseconds might not be much but it can easily turn into 10 seconds if the server is overloaded. 10 seconds delay after submitting a _validated_ form to complete sales transation and display a success message is not a big deal, the user has already made a decision and now they're going to see the positive result. Your site is slow == that's ok, I made the purchase anyway.

10 seconds delay to validate form values and display an error message would most probably result in a lost sale. Your site is slow == it's bad, I won't spend my money here.

It's as simple as that.

> I agree. But I don't agree React _benefits_ developer productivity. On the contrary, I think it (and its competitor frameworks) are responsible for a lot of wasted developer time and frustration.

That's a highly subjective assessment. Do you have a way to measure productivity gains or losses? I don't either, just some anecdata.

About a year ago I needed to build an app for my ongoing personal (at some point to be commercial) project. Think a simple portal for adding, editing, and deleting entities. I decided that since it was internal use only, I can ditch the fancieties and do a quick and dirty old style app: server side logic, form submissions, full page reloads, etc. Back to 1999.

I spent a month of evenings trying to get it done, and didn't get halfway before ditching the effort and rewriting it as simple front end single page app + simple back end that exposed stateless API for the client to consume. That took me 2 weeks worth of evenings.

Lesson learned: never again, there's just too much mess with server side HTML templating, state propagation between page loads, form validation, etc etc. I don't even want to think about partial updates that _still_ involve server side HTML templating but combine that with a double dose of state propagation and synchronization. I didn't even get to writing any tests for that server side, simply because abstracting templating code from actual logic code was painful.

It can be argued that I did not use the best server side framework, did not know what I was doing, etc. That's actually my point: if doing old style web apps was so much easier, I should have been able to complete it fast without much sweat, no?

Re:Things I wish I knew about state management when I starte... by dvfjsdhgfv on Tuesday February 11, 2020 @02:12AM (#22296682)
> It can be argued that I did not use the best server side framework, did not know what I was doing, etc. That's actually my point: if doing old style web apps was so much easier, I should have been able to complete it fast without much sweat, no?

Having seen many similar discussions I came to the conclusion this might really be something of a generation gap. For those of us who spent their youth developing web apps back in the day, doing it the "old" way (that fortunately still works) seems natural and easy. And in some cases it's ridilously easy. If your needs are fairly typical (like the CRUD you describe), you might not even need to do that much - Django Admin or Laravel Voyager will take care of these.

Re:Things I wish I knew about state management when I starte... by nohuhu on Wednesday February 12, 2020 @01:31PM (#22311342)
No generation gap here. I was building my first web apps in early 2000s as well, with Apache and mod_perl. That was exactly the point of that experiment: hey I recall this stuff was _easy_, I don't need it fancy, let's take the modernest server side framework and go for it.

No thanks, not gonna do that ever again. Rosy glasses are rosy, and cleanly separated client side app + back end API is clean and separated.

Re:Things I wish I knew about state management when I starte... by dragonwriter on Tuesday February 11, 2020 @05:06AM (#22297343)
> For those of us who spent their youth developing web apps back in the day, doing it the "old" way (that fortunately still works) seems natural and easy.

Spent my youth doing it the old way. Much rather use either React for nontrivial apps, still, now.

Re:Things I wish I knew about state management when I starte... by ativzzz on Monday February 10, 2020 @02:57PM (#22292610)
The OP mentions

> They're forms that submit stuff to a server and get a response.

So it sounds like they're not actually doing any of the things you mention. For basic forms that just submit, of course React is overkill. Hell, a software developer is overkill for that. For any of the things you mention, React or another similar UI framework makes the project much more manageable.

Re:Things I wish I knew about state management when I starte... by dotancohen on Monday February 10, 2020 @03:17PM (#22292792)
Thank you for actually answering the question! Your list of functionality is the first that I've seen which actually shows where React really is helpful.
Re:Things I wish I knew about state management when I starte... by bdcravens on Monday February 10, 2020 @03:34PM (#22292972)
The issue seems with moving responsibilities that the server handles really well to the client (namely, state and session management). I think it's less a matter of Javascript-framework vs no framework, and more a matter of SPA vs. non-SPA
Re:Things I wish I knew about state management when I starte... by mands on Monday February 10, 2020 @04:29PM (#22293578)
This hits the nail on the head - it's about SPA vs MPA. Component-based architectures are a proven and a win on FE for more complex interactions, but that doesn't necessitate an SPA. We had a large SPA with a REST API backend and were finding it really difficult to add more features to the FE due to the inherent complexity of the SPA.

We decided to split it into an MPA, adding React components to server-side rendered pages as needed (along with intercooler and stimulus when we don't need the power of React).

Things have become much simpler and quicker to develop, allowing us to focus on the user features instead. It's easy to forget how much you get for free from the browser and traditional HTTP/HTML client-server mechanics, along with the ease of having full access to your database and data model in your templates - and makes you wonder if going with an SPA first is throwing the baby out with the bathwater.

Re:Things I wish I knew about state management when I starte... by acephal on Monday February 10, 2020 @02:35PM (#22292404)
Mmm, I work on a multimedia sequencer (timeline, viewport, etc) in the browser, it would be utter hell if the whole thing was put together via manual DOM updates in something like a Backbone View render function. I know this because when I joined the company, they were trying to do it in Backbone. For a project of that scope, this was a great way to introduce a large surface for error and maintenance (the project kicked off right when React was launching and Typescript wasn't public). Leveraging React as an interface to updating the DOM removes all of those concerns from your implementation work. That's a big productivity boost when you're trying to build a multimedia sequencer. More so when your team is junior-dominant.
Re:Things I wish I knew about state management when I starte... by Jare on Monday February 10, 2020 @04:20PM (#22293506)
> when React was launching and Typescript wasn't public

Minor correction, React came out about 7 months after Typescript. That said, Typescript had a promising birth but a rough infancy, so I wouldn't blame anyone for considering it released only after 1.x versions starting in late 2014.

Re:Things I wish I knew about state management when I starte... by acephal on Monday February 10, 2020 @05:19PM (#22294023)
Yeah, that was bad characterization. This was the first half of 2015.
Re:Things I wish I knew about state management when I starte... by itronitron on Monday February 10, 2020 @01:59PM (#22292063)
I've worked on a few applications with 'rich/complex interactions' and everyone on the team was opposed to using any sort of JS framework. That was nice because it was relatively easy for anyone to trace through the application as needed.

In my experience if the application state is overly complex then that is a result of the design, and that usually leads to a bad experience for the user.

Re:Things I wish I knew about state management when I starte... by spookthesunset on Monday February 10, 2020 @03:08PM (#22292704)
> I've worked on a few applications with 'rich/complex interactions' and everyone on the team was opposed to using any sort of JS framework

Ah but if you actually looked at what you built, I am 100% sure you folks built your own framework instead. A framework that has no community support, no stackoverflow articles to help out and most likely minimal explicit documentation. You will never be able to hire talent that already knows the tools for your framework. You'll be spending all of the next eternity cobbling together features that you could have had out of the box had you adopted somebody else's framework instead.

The choice is never "use a framework" vs. "don't use a framework". The choice is "do we use somebody else's framework" vs. "do we build our own framework". What you implicitly and unknowingly chose was the "we are gonna build our own framework" option.

In my experience, the minute the few folks who pushed the "no framework" option leave the company, all the rest of the developers smile and scramble to replace the hot mess of a codebase with something using an industry accepted framework.

Re:Things I wish I knew about state management when I starte... by crtlaltdel on Monday February 10, 2020 @03:28PM (#22292922)
i've seen a shop start as a "no-framework" effort and it did indeed become an "internal framework" project. imo it was a strange choice, given how much effort had to go into maintaining and bugfixing the internal framework...mostly issues that would have been flushed out in something with wider support.

before being involved in mostly "modern saas", i was heavy in electrical/electronics mfg and there was always a tension between "not-invented-here" and "borrow-buy-build" camps. NIH would stress that all components in our designs should be in-house (electrical metering, data acquisition, etc) while the BBB camp would turn every effort into a 3rd party integrations exercise. at times this even applied to the factory floor. i seriously know a person who was like "hrm, lets build our own pick-and-place for the smt line..."

Re:Things I wish I knew about state management when I starte... by spookthesunset on Monday February 10, 2020 @04:03PM (#22293306)
> i seriously know a person who was like "hrm, lets build our own pick-and-place for the smt line..."

I mean, how hard could building our own pick & place be, right? Once you strip out all the bloat the vendors add to make a sale, it is nothing you couldn't do with a couple servos and a $5 Arduino, right?

I think the "build everything ourselves" attitude comes from a not at all understanding opportunity costs and comparative advantage. Plus in the software industry, tons of developers I've encountered are super paranoid about "vendor lockin" without realizing that once they roll their own library/framework/pick-and-place-machine they have effectively locked their employer into a vendor as well. Only instead of a third party vendor with all the benefits that may come with it, they've "purchased" a product from a really shitty vendor--themselves!

It is never a choice between:

"Platform or no platform"

"Framework or no framework"

"Vendor lock-in or no vendor lock-in"

You will always be on a platform. You will always be using a framework and you'll always be locked into a vendor. The trick is to make sure you don't lock yourself into a shitty vendor who makes a shitty platform or framework.

Re:Things I wish I knew about state management when I starte... by FpUser on Monday February 10, 2020 @11:30PM (#22296073)
Not directly related to web front end but having extensive developer experience I tend to shy big frameworks (with a couple of exceptions) . Instead I am using set of battle proven libraries that change depending on needs.

My reasons are:

  I do not need to learn a monster
  If framework goes down/becomes unpopular etc. etc. I could care less
  Libraries are easily abstracted and replaceable.
  
Yes I/team do end up implementing our own framework but this framework is very tiny comparatively to you common monstrous frameworks and any sane person can get a grip in a day or less and it only has enough to accomplish a project.

Also it can be easily sliced/diced and needed accumulated bits and pieces can be used for next project.

Re:Things I wish I knew about state management when I starte... by flukus on Monday February 10, 2020 @05:46PM (#22294246)
> A framework that has no community support, no stackoverflow articles to help out and most likely minimal explicit documentation.

But there are gains too. The custom framework is probably much smaller and less complex, easier to know 100% of. It can be stepped through in the debugger. It's much easier to change and add features that your company needs, there's no outside bureaucracy to get in the way.

I disagree you're inventing your own framework too, there is a distinction to be made between libraries and frameworks. Just because I'm not using a framework doesn't mean I'm reinventing it, I could be using something like knockoutjs instead, or even postbacks.

Re:Things I wish I knew about state management when I starte... by spookthesunset on Monday February 10, 2020 @10:50PM (#22295886)
Mark my words, you’ll be spending the rest of your days poorly reinventing what was already done in a real framework. I’ve seen what comes of these “I don’t want to use a bloated framework” shops and it is never pretty. The second the people who eschew mainstream frameworks leave, the devs who are still are around will quickly rebuild around a real framework.
Re:Things I wish I knew about state management when I starte... by arvinsim on Monday February 10, 2020 @08:00PM (#22295054)
React, Vue and Angular can all step through debuggers.
Re:Things I wish I knew about state management when I starte... by kqr on Monday February 10, 2020 @02:45PM (#22292501)
In my experience, when it comes to rich interaction, the question isn't whether or not to use a framework -- the question is whether to write your own framework from scratch and discover all mistakes you can make on your own, or use one that already exists and builds on best practises as well as we know them.
Re:Things I wish I knew about state management when I starte... by bernawil on Monday February 10, 2020 @03:27PM (#22292902)

  In my experience if the application state is overly complex then that is a result of the design, and that usually leads to a bad experience for the user.
Though it is possible to overengineer this, you're probably underestimating ho seemingly simple apps can justifiably have complex state.

Say you make API calls. Your application state just grew to reflect

1. Pending request 2. Request succesful or failed 3. Request result or error 4. Finished request.

Redux apps track all of this explicitly. The alternative to this is not reducing statefulness. It's just ignoring it with all the brings.

Re:Things I wish I knew about state management when I starte... by itronitron on Monday February 10, 2020 @04:21PM (#22293512)
Oh I agree with that, I just think that the internal state of the app can be more easily managed if those potential application states are explicitly identified during the design stage.
Re:Things I wish I knew about state management when I starte... by wefarrell on Monday February 10, 2020 @02:10PM (#22292164)
It sounds like you don't see the need for single page applications, which is a larger discussion.
Re:Things I wish I knew about state management when I starte... by bernawil on Monday February 10, 2020 @03:17PM (#22292788)

  They're forms that submit stuff to a server and get a response
What kind of response? Asuming no React,

a. json

b. SSR-html?

If,

a. Now you've got to process that response, handle errors and finally render into html. You'll be either imperatively replacing DOM nodes, interpolating string templates or both. Probably re-binding event handlers after that.

b. You'll be merging your server-rendered html to your current view. Re-binding event handlers if you've got any interactive stuff (e.g your SSR came with a modal link) and god knows what else.

React is a million times better than this.

Re:Things I wish I knew about state management when I starte... by z3t4 on Monday February 10, 2020 @05:41PM (#22294210)
I just use vanilla JS. For transport I use JSON over Websockets (with fallback to long-polling if the user is behind a proxy that doesn't support Websockets). I format the messages like id+command+json-payload. If the message contains an id, it calls the callback function given by the API request. If no id is given, the event listeners for "command" are called. In a higher level there are more events that can be listened for.

For layout I use a mix of both pure and imperative functions that either creates a new element for every state, or modifies existing elements - however all isolated in a component or widget.

I try to use standard HTML5 elements rather then creating my own. But they are often inside a component or widgets which takes care of events like keypress, mousedown etc.

There are no string templates! No server rendering, just API endpoints. There is no JQery, there is no framework - besides the functionality for handling server messages and passing data to event listeners and callbacks. Some components and widgets are generic and can be reused in other projects. But most are specific to the app itself.

The advantages is that it's simple, fast, and customizable. The disadvantage is that layout is a bit tedious using appendChild instead of XML/JSX.

I use CSS for styling. I like CSS very much probably because I used to do web apps before CSS existed. To change theme you just change the .css file. Components, widgets and elements are not aware of theme and style, that's all handled by CSS. Animations are handled by CSS, and different screen sizes are also handled by CSS. Sometimes you need to the change components/widgets though.

The only advantage I see with frameworks is that you get to write XML/JSX/HTML, which makes it more easy to move things around vs just using JS functions and appendChild. But when looking at React apps the components are broken down into individual files anyway, so it's difficult to get an overview.

Probably the biggest advantages of going vanilla JS eg. no JSX nor frameworks, is that debugging becomes easier, and you do not need a build pipeline, just refresh or hot-reload individual functions. No bundles or package managers needed.

Re:Things I wish I knew about state management when I starte... by imiric on Monday February 10, 2020 @11:41PM (#22296120)
That sounds like a great framework. Let us know when you release it. :)

The points made elsewhere in this thread still stand: a bespoke framework might be conceptually simpler and much easier for a solo developer, but for larger apps that require a team of developers using a popular framework would be much more productive overall, as everyone is or should be on the same page with how features are implemented. This often results in poor UX where specialized knowledge about the framework is needed to improve performance and scale, which you as the author of yours know by heart and find it much easier to achieve similar or better results.

I'd say neither approach is inherently bad. Use whatever delivers the best UX for the project at hand, but know that you'll be paying a price when that approach reaches its limits.

Re:Things I wish I knew about state management when I starte... by z3t4 on Tuesday February 11, 2020 @04:33AM (#22297201)
For short living projects, say two moths or half a year, I would probably go with an existing framework, for that initial speed and reuse of existing libraries/plugins. But for anything you would spend one year or more on, I would build a custom solution which optimizes for whatever is the domain priority, for example front-end performance, speed of development, etc. If you use your own "framework" it will become stable over time, where as a popular frameworks like React or Angular will just keep changing and eventually reach end of life support.
Re:Things I wish I knew about state management when I starte... by pests on Monday February 10, 2020 @03:42PM (#22293053)
You forget the most basic response. A full HTML file with a corresponding reload. None of what you said applies. I'm a big react fan and advocate too but sometimes I think we forget about the basics.
Re:Things I wish I knew about state management when I starte... by bernawil on Monday February 10, 2020 @03:55PM (#22293197)
First time I hear XMLHttpRequest was a mistake.

No one is going to sit through a full-page reload on every form validation.

Even intermediate solutions that merged (hacked) client-server state failed too. APIs are just better.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Monday February 10, 2020 @04:51PM (#22293788)
The irony is you're posting on HN, which does exactly what you suggest no one will tolerate. How slow is this form submission for you? ;-)
Re:Things I wish I knew about state management when I starte... by shepmaster on Monday February 10, 2020 @05:45PM (#22294237)
Conversely, the upvote button (which I used for your point) doesn’t perform a full refresh. Both are good.
Re:Things I wish I knew about state management when I starte... by istjohn on Monday February 10, 2020 @06:27PM (#22294518)
Turn off your JS and upvote something. It becomes substantially less pleasant.
Re:Things I wish I knew about state management when I starte... by kotharia on Monday February 10, 2020 @06:58PM (#22294722)
Turn off JS and load an SPA :p
Re:Things I wish I knew about state management when I starte... by bernawil on Monday February 10, 2020 @06:15PM (#22294452)
hey, we all love how fast HN loads, not gonna argue!

On the other hand, I don't think it's usable for other crowds. I spend most of my day inside vim, so I'm used to switching windows and going back all the time but I don't think that having to load a submit form in a new page, losing all context of the conversation tree is particularly usable.

Re:Things I wish I knew about state management when I starte... by karatestomp on Monday February 10, 2020 @08:44PM (#22295238)
Sites or "apps" relying heavily on full page loads are, in my experience, much faster than their "efficient" XMLHttpeRequest counterparts, in practice. As in, click, thing happens, thing is done happening, much faster. We even have examples of this with the same "app"—Gmail, for example: Basic HTML, "mobile", standard, and, though I think it's gone now, Inbox. At least four versions. Basic HTML is less janky than "mobile" on mobile, and much, much faster than standard or Inbox, despite "inefficient" full page loads.
Re:Things I wish I knew about state management when I starte... by acdha on Monday February 10, 2020 @04:32PM (#22293622)
> No one is going to sit through a full-page reload on every form validation.

Why not? Most of the pure HTML forms I use load at least an order of magnitude faster than the complex SPAs I use because there's so many fewer network requests. You can make SPAs which are as fast but I'd say fewer than a third companies, even very large ones like Google or Facebook, succeed at doing so and an even smaller percentage have thought hard enough about error handling. On a daily basic I use sites from Google, Twitter, Facebook, etc. where I have to do a reload anyway because their developers were unaware that network operations require timeouts, retries, and that you need to provide UI feedback for all of those to match what the browser provides by default.

EDIT: to be clear, I like that we can do a ton of very complicated things in a browser now — we've been working towards that as an industry for the last 3 decades and it's great that it's largely arrived — but I think it really hits the failure of companies to skimp on resources for anything which isn't critical to the default user experience. Duplicating built-in functionality should be seen as an expensive commitment, not the default unless you're willing to devote the extra resources needed.

Re:Things I wish I knew about state management when I starte... by kreetx on Monday February 10, 2020 @05:05PM (#22293892)
I agree with this.

Yes, ideally, a SPA could be better (i.e why re-send the parts of the app that didn't need to change), but most of these apps are actually way slower -- either because the developers don't know/care beteer, or perhaps more probably, are not given the time to implement the perfect(-ish) solution.

A full html page reload isn't much slower than react/redux doing a json fetch, but it may appear so since most of the content doesn't flash, new content comes in with an effect etc. And I agree, this looks more slick.

Re:Things I wish I knew about state management when I starte... by the_gastropod on Monday February 10, 2020 @04:50PM (#22293773)
pjax is about a decade old at this point, dirt simple, and easily handles re-binding event handlers. Check it out: https://github.com/defunkt/jquery-pjax

Turbolinks is a more contemporary library that does much the same.

It doesn't need to be complicated.

Re:Things I wish I knew about state management when I starte... by imtringued on Monday February 10, 2020 @08:01PM (#22295066)
I would like to see a chat application implemented with just forms that submits stuff. How are you going to get new messages?
Re:Things I wish I knew about state management when I starte... by toast0 on Monday February 10, 2020 @08:17PM (#22295133)
Ok, so don't do this, but script src=/fetchmessages.js?t=1

Which returns document.write(messagecontent) //if message document.write(script tag t=n+1)

If there are messages, server returns them all immediately, plus the repoll JS, and if there aren't any, it waits N seconds before returning just the repoll.

This could fit pretty well into an IRC single channel model, where you just stuff all the messages into a single place. For something more akin to MDI/TDI where you have different message displays depending on who you click on, it's trickier to just shove the messages in at the end --- although, if you were a terrible person, you could do something like use the chat id with a prefix as a class name, and use that to show/hide. You still need dom manipulation to add new chats.

Re:Things I wish I knew about state management when I starte... by icedchai on Monday February 10, 2020 @10:50PM (#22295883)
This was done in the 90's. You simply refresh the page periodically. You can use the HTML "meta refresh" tag, no JS required.
Re:Things I wish I knew about state management when I starte... by jrandm on Tuesday February 11, 2020 @01:22AM (#22296500)
I got sidetracked searching for pictures of the multiplayer part of the game Vagabond's Quest.[0] I wasn't successful, unfortunately, but a number of the pages outside the login wall were archived.[1]

I think you might find several of these pages entertaining,[2] especially if you're familiar with text-based games (especially MUDs and MOOs[3]) and a Dungeons and Dragons-esque setting. The items, combat (PvP and 1-player), and any other aspect of chance were transparently dice rolls and modifiers in-game.

Because this is Hacker News, don't miss out on the >20-year-old anti-hacking mechanism.[4][5] Keep in mind this is for a sequel or companion game that came (IIRC years) after the original.

With that stage set, picture a black background and some grey text with scattered red/green/blue highlights. The logo was probably the only image. The page would reload every few seconds, but you could manually reload and see new messages sooner. If your username was in a chat text it would make the text larger (both the line and your name, I think).[6] Maybe under a few other conditions too: if you were fighting someone, if it was the admin/mod/dev(!) Falados, I think you could add a few of your own word filters at some point. Originally it was just your username in the line, I'm pretty sure. The combat moves and rolls were also part of this chat stream. I remember being in busy rooms with dozens of people, frantically refreshing, trying to read the top of the screen quickly before it was lost.

It was great!

I hadn't quite connected the games to programming yet, but I imagine the Hall or Arena you "joined" for Player vs Player combat and chat was by visiting the page of HTML generated by Perl scripts (I remember URIs ending in .pl, maybe some CGI thing?) that had a meta tag to trigger the refresh. It had a regular form with a submit button and the page reload was convenient because that was the only way to see your message or anyone else's new in the page.

I'm amazed how clearly I remember playing, if the details are a bit fuzzy. Looking for pictures I came across this,[7] and am excited to read through and maybe check out a beta. Thanks for prompting the search!

[0]: http://www.angelfire.com/games2/LanderZ/vq.html

[1]: https://web.archive.org/web/20000818004717/http://www.netdra...

[2]: https://web.archive.org/web/19990902013706/http://www.netdra...

[3]: https://en.wikipedia.org/wiki/MOO

[4]: https://web.archive.org/web/19991105152436/http://www.netdra...

[5]: https://crypto.stackexchange.com/questions/47177/would-sha1-...

[6]: FONT tags, I'm 99% sure. This was probably one of my early view-source learn-by-example sources, in a futile attempt to cheat

[7]: https://playvq.com/roadmap/

Re:Things I wish I knew about state management when I starte... by derefr on Monday February 10, 2020 @05:50PM (#22294274)
I think React's use-case is multi-model visualization tools (e.g. a Bloomberg terminal) and cross-visualization editing tools (e.g. Business Intelligence software.) Things where one data source gets data-bound not just to to multiple views, but to multiple view controllers which expose the data differently.
Re:Things I wish I knew about state management when I starte... by ojr on Monday February 10, 2020 @03:23PM (#22292853)
with react native I am able to leverage native device apis in Javascript without writing the underlying Swift or Java bridge, there are so many super popular libraries (5k + stars on github), image pickers, contacts, file systems, ui elements that support both platforms and have huge open source support. I am able to create components faster in React or a framework with up to date documentation/testing than using a custom component solution and speed is always in fashion.
Re:Things I wish I knew about state management when I starte... by mr_toad on Monday February 10, 2020 @04:51PM (#22293785)
> They're forms that submit stuff to a server and get a response.

React is overkill for something that simple. You don’t even need JavaScript for simple forms.

Re:Things I wish I knew about state management when I starte... by rorykoehler on Monday February 10, 2020 @05:10PM (#22293940)
I've been writing vanilla javascript on the frontend for a recent project. It's really not bad. Much less cognitive load compared to writing react. Easier to read too
Re:Things I wish I knew about state management when I starte... by mesaframe on Tuesday February 11, 2020 @01:22AM (#22296502)
Is JavaScript is a need making a library/framework over it doesn't make it any better.

Also, you stated benefits of Fact without stating how it makes it better.

Re:Things I wish I knew about state management when I starte... by GrumpyNl on Monday February 10, 2020 @04:59PM (#22293850)
I disagree with making it easier. Php, jquery and css will bring you a long way. react is far more complex.