Daniel Espino Garcia
Dos and don'ts with react hooks. An opinionated approach
#1about 4 minutes
Understanding the internal mechanics of React hooks
Hooks enable state in functional components and are implemented as a linked list, which explains why they must be called in the same order on every render.
#2about 2 minutes
Prioritize code readability over premature performance optimization
Focus on writing clear, future-proof code instead of worrying about minor performance overhead from hooks, as these are rarely the actual application bottleneck.
#3about 2 minutes
Move constants and pure functions outside components
Improve readability and performance by defining constants and pure helper functions outside the component scope, avoiding unnecessary re-creation on each render.
#4about 2 minutes
Declare explicit dependencies instead of inferring them
Always declare direct dependencies in hooks like useEffect and useCallback to prevent subtle bugs when the code is modified later.
#5about 2 minutes
Improve clarity with intermediate variables for derived state
Create meaningful intermediate variables from props or state to represent business logic, making the code more readable and hook dependencies more precise.
#6about 2 minutes
Use useRef for data that shouldn't trigger re-renders
Store values that persist across renders but don't affect the UI, like pagination counters, in a useRef to avoid unnecessary component re-renders.
#7about 1 minute
Stabilize callbacks with the functional setState form
Use the functional update form of setState to compute new state from the previous state, which removes the state variable from dependency arrays and prevents unnecessary re-creations of callbacks.
#8about 1 minute
Calculate derived state directly instead of in useEffect
If a piece of state is calculated from props within a useEffect, it is derived state and should be computed directly during the render to avoid an extra re-render cycle.
#9about 2 minutes
Extract reusable logic into custom hooks
Encapsulate and share repeated component logic, such as handling an Android back button, by creating custom hooks for better maintainability and readability.
Related jobs
Jobs that call for the skills explored in this talk.
Douglas GmbH
Düsseldorf, Germany
Intermediate
Senior
TypeScript
React
Picnic Technologies B.V.
Amsterdam, Netherlands
Intermediate
Senior
TypeScript
Angular
+1
Matching moments
11:32 MIN
The industry's focus on frameworks over web fundamentals
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
11:10 MIN
The only frontend stack that truly matters
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
03:05 MIN
Building collaborative design tools and the neo-brutalism trend
Slopquatting, API Keys, Fun with Fonts, Recruiters vs AI and more - The Best of LIVE 2025 - Part 2
04:49 MIN
Using content channels to build an event community
Cat Herding with Lions and Tigers - Christian Heilmann
04:02 MIN
How a broken frontend culture impacts the web
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
14:14 MIN
Scripting presentations and demos in VS Code
Devs vs. Marketers, COBOL and Copilot, Make Live Coding Easy and more - The Best of LIVE 2025 - Part 3
02:44 MIN
Rapid-fire thoughts on the future of work
What 2025 Taught Us: A Year-End Special with Hung Lee
03:38 MIN
Balancing the trade-off between efficiency and resilience
What 2025 Taught Us: A Year-End Special with Hung Lee
Featured Partners
Related Videos
Rethinking React State Management: The Power of Built-In Solutions
Marc Brehmer
State management in a world of hooks
Adam Klein
MVI: Minimum Viable Interface for React Components
Daniel Espino Garcia
Keith Cirkle of GitHub on React Fatigue
Keith Cirkle
Bringing back reactivity in "reactive" frontend
Michał Moroz
Building Interactive Async UI with React 19 and Ariakit
Aurora Scharff
What the heck do "declarative" and "reactive" actually mean?
André Kovac
Common Mistakes in Vue.js and How to Avoid Them
Daniel Kelly
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.

Visonum GmbH
Remote
Junior
Intermediate
React
Redux
TypeScript


VanHack
Barcelona, Spain
Senior
API
iOS
Java
Kotlin
JavaScript
+3



Top web
Remote
£145-187K
Intermediate
React
JavaScript
TypeScript


