#frontend

9 articles

React TUTORIAL

React Hooks Part 5: Sharing State with useContext

useContext lets any component read shared state without threading props through every layer. This article covers createContext, Provider setup, and the patterns that keep context from becoming a performance trap.

w
webencher Editorial
· 8 min read · 292 views
React TUTORIAL

React Hooks Part 9: Testing Hooks with React Testing Library

Hooks are just functions, but testing them well requires care. This final article covers testing hooks through components (the preferred way), using renderHook for isolated custom hook tests, and common async patterns.

w
webencher Editorial
· 10 min read · 137 views
React TUTORIAL

React Hooks Part 7: useImperativeHandle and useLayoutEffect

Two escape hatches most tutorials skip: useImperativeHandle for exposing a controlled API from a child component, and useLayoutEffect for DOM measurements that must happen before the browser paints.

w
webencher Editorial
· 8 min read · 181 views
React TUTORIAL

React Hooks Part 8: Rules, Anti-Patterns, and the ESLint Plugin

Hooks come with two hard rules enforced by the ESLint plugin. This article explains why those rules exist, the most common anti-patterns developers fall into, and how to restructure code when you feel the urge to break them.

w
webencher Editorial
· 7 min read · 157 views
React TUTORIAL

React Hooks Part 3: useRef and useReducer

useRef gives you a mutable container that survives renders without causing them. useReducer brings Redux-style state machines to any component. Together they handle the cases useState and useEffect cannot.

w
webencher Editorial
· 10 min read · 490 views
React TUTORIAL

React Hooks Part 2: Side Effects with useEffect

useEffect is how React functional components interact with the outside world — fetching data, setting up subscriptions, and manipulating the DOM. This article explains the dependency array, cleanup, and common pitfalls.

w
webencher Editorial
· 9 min read · 629 views
React TUTORIAL

React Hooks Part 1: Managing State with useState

Learn how useState lets functional components hold and update local state. We cover the basics, the callback pattern to avoid race conditions, and object/array state management.

w
webencher Editorial
· 7 min read · 754 views