from Hacker News

Reducing Bloated React Code

by cruxcode on 4/11/23, 1:49 AM with 0 comments

What do you find in a bulky web app code? 1. Less component reuse 2. Un-generalized way to write React components. 3. Data manipulation logic that could be handled in backend.

Developers have a tendency to write React code first and then put them in a React component later.

Developers don't have a fixed pattern of writing components. They decide prop signature randomly. This leads to other problems, such as, it's hard to generalize other pieces of code such as store update/read etc.

Writing data manipulation logic in the frontend has become very common problem. The client side frameworks have imparted this bad habbit in new gen developers.

Please share the best practices/rules you follow to keep the bundle size & code smaller.