0% found this document useful (0 votes)
15 views8 pages

React Tips

Uploaded by

wenemagic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

React Tips

Uploaded by

wenemagic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PixEarn.

com

Not just syntax Tips


But mindset shifts
most developers
ignore

[Link]
Tips page 01

Yashraj | @yrjdeveloper
[Link]

Real habits to write


better, cleaner
React code

Real
[Link] page 02

Yashraj | @yrjdeveloper
[Link]

Stop Overusing
useEffect
Don’t use useEffect for everything
Use it only for real side effects (like API
calls)

Wrong: syncing props, running conditions


Right: data fetch, event listeners

Think before you


effect.
page 03

Yashraj | @yrjdeveloper
[Link]

Avoid Inline
Functions in JSX
❌ onClick={() => doSomething()}
Every render = new function
Breaks memoization

Use functions outside JSX


Use useCallback if needed

Keep handlers
stable
page 04

Yashraj | @yrjdeveloper
[Link]

Don’t Overuse
useMemo / useCallback
Memo != performance by default
If misused = slower app

Use when:
Heavy re-renders
Expensive calc

Only memo when


needed
page 05

Yashraj | @yrjdeveloper
[Link]

Don’t Overuse
Context
Putting all state in
Context = re-renders everywhere

Use Context for:


Theme
Auth
Static config

For changing state →


use Zustand or
Redux
page 06

Yashraj | @yrjdeveloper
[Link]

Don’t Ignore
Accessibility
Ignoring a11y makes your app unusable for
many

Use :
Semantic tags
Labels & roles
Keyboard support

a11y = real dev


skill
page 07

Yashraj | @yrjdeveloper
[Link]

Want more tips?


Like, Share, Follow

Avoid common traps


→ write better React
Which one surprised you?

If you have any tip for ReactJS


Comment down below
page 08

Yashraj | @yrjdeveloper

You might also like