
React Considered Harmful - lupin_sansei
https://www.werkema.com/2020/05/18/react-considered-harmful/
======
testbot123
This is somewhat disingenuous. They give the simple example below:

    
    
      $(".fooButton").click(function() {
          $.ajax("/update-foos", { method: "POST" });
      });
    

and then give the "same" example the React treatment, which not only includes
third party libraries for fetching, but also managing fetch state, storing
data, and connecting to the store, which none of the above does.

A better version of React doing the above would be:

    
    
      export function FetchDataButton ({ ...buttonProps }) {
        const fetchData = useCallback(() => fetch('/update-foos', {method: 'POST'}), [])
        // prop drilling for this example only. don't do this normally.
        return <button {...buttonProps} onClick={fetchData} />
      }
    

which does exactly what the initial example does, additionally rendering the
actual button, built-in DOM reconciliation, a declarative API, built-in
reactivity (meaning you don't have to handle figuring out what gets updated in
response to new data), etc etc.

Yes, React introduces boilerplate but not as much as this post makes out, and
certainly not enough to warrant the "considered harmful" label.

> We — all of us — are not mature enough yet for abstractions like React.

Not quite. _You_ aren't ready because you haven't learned the basic concepts
enough to understand the problems that React is solving.

