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.

Red Flags in a React Codebase

3 pointsby omarfarooqover 1 year ago

1 comment

ttfkamover 1 year ago
Let&#x27;s examine these limitations in the context of Svelte&#x2F;SvelteKit:<p>• functions named handleClick,handleSubmit<p>Agreed, not as descriptive as it could be, but when your component is noticeably smaller, arguably not as big a deal.<p>• preventDefault<p>React tries control the execution model to the point that plain JS ends up in an impedance mismatch. Go ahead in Svelte since it embraces JS. Or you can use<p><pre><code> on:click|preventDefault={doIt} </code></pre> • useMemo<p>N&#x2F;A. This is an abstraction leak solely of React&#x27;s making. Not needed at all in other frameworks like Svelte.<p>• fetch inside useEffect<p>A special wrapper library to use the Fetch API in React? Sure, you could use a wrapper in Svelte as well, but it&#x27;s not necessary.<p>• &lt;div onClick&#x2F;&gt;<p>Universally good advice no matter your framework. Use button or a tag.<p>• a &quot;hooks&quot; directory<p>Here&#x27;s where a framework being more opinionated helps. Technically it doesn&#x27;t matter where the hook logic lives, but having the framework make that decision means you don&#x27;t have to, and others don&#x27;t have to hunt around as much to find it.<p>• css files<p>Svelte scopes CSS to the component by default. No arm-twisting or custom build logic needed.<p>• icon library in package.json<p>Your tree-shaking tools work or they don&#x27;t.