TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

React Considered Harmful

1 pointsby lupin_sanseiabout 5 years ago

1 comment

testbot123almost 5 years ago
This is somewhat disingenuous. They give the simple example below:<p><pre><code> $(&quot;.fooButton&quot;).click(function() { $.ajax(&quot;&#x2F;update-foos&quot;, { method: &quot;POST&quot; }); }); </code></pre> and then give the &quot;same&quot; 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.<p>A better version of React doing the above would be:<p><pre><code> export function FetchDataButton ({ ...buttonProps }) { const fetchData = useCallback(() =&gt; fetch(&#x27;&#x2F;update-foos&#x27;, {method: &#x27;POST&#x27;}), []) &#x2F;&#x2F; prop drilling for this example only. don&#x27;t do this normally. return &lt;button {...buttonProps} onClick={fetchData} &#x2F;&gt; } </code></pre> 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&#x27;t have to handle figuring out what gets updated in response to new data), etc etc.<p>Yes, React introduces boilerplate but not as much as this post makes out, and certainly not enough to warrant the &quot;considered harmful&quot; label.<p>&gt; We — all of us — are not mature enough yet for abstractions like React.<p>Not quite. <i>You</i> aren&#x27;t ready because you haven&#x27;t learned the basic concepts enough to understand the problems that React is solving.