Hacker News new | ask | show | jobs
by benbristow 1798 days ago
Cool.

Project Manager: Now add 3 checkboxes, one being 'N/A' and when you select N/A the other checkboxes are disabled and unchecked. And update the labels, and have additional form sections showing depending on which checkbox is displaying.

Probably not that difficult, and probably a bad example, but with React/Vue/etc. it's a lot easier to deal with complex states than manually manipulating the DOM.

From experience trying to be clever and anti-framework ends up just creating another framework that's worse in every imaginable way.

4 comments

Hum... Your new function reads all the checks, calculate the new values and enabled conditions, and applies them. It's called by the onChange of all of the relevant elements.

Reactive frameworks do make your life simpler (at least once you pay for the large one time cost of using them), but the change isn't enormous.

Or you just use React and it has that function already built for you...

All you need to do is call setState

You certainly doesn't mean that React has your business rules builtin.
No, but it'll deal with changing the UI depending on your state once you've wired the rules in.
> clever

Virtual DOM qualifies as clever in my book. :)

Better question to ask is why so many libraries/frameworks proliferate in webdev and not as much in native apps. JS is a suitably powerful language these days.

Also, the attitude of “just use jQuery like everyone else” (paraphrasing the last paragraph and substituting for React) would have precluded the development of React.

The cleverness is abstracted from you as a developer and the cleverness is maintained by an open-source community and a huge corporation (Facebook).

With native apps you definitely have frameworks available now. React Native for an example. But the languages and toolkits available basically serve as a framework anyway.

Is cleverness only allowed for the FAANGs of the world? I cannot subscribe to such a nihilistic view of computation.

SICP should be required reading for any serious dev if only to expand their imagination beyond an industry that is intensely focused on boiling the difficult and creative endeavor we call software development into a discrete, repeatable process.

I mentioned the open-source community in my comment. So a collective of knowledge of many talented developers from the public, and also the stewardship of a FAANG and their developer talent pool also.
is that how react was invented?
And they also end up with a lot of useless framework knowledge they'll never use again after the project goes up in flames.