Render Props vs Hooks for Stateful Logic
You'll learn when render props still have a place in modern React, and when hooks are the clear winner.
The Great Transition
When React Hooks arrived in version 16.8, they revolutionized how we share stateful logic. Before hooks, render props were the elegant solution for extracting and reusing component behavior. Now, hooks handle 90% of those use cases more simply.
When Hooks Win (Most of the Time)
For pure logic sharing—managing state, side effects, or derived values—custom hooks are cleaner and more composable. A useMousePosition hook returns coordinates directly. No wrapper components, no extra nesting, just values you can use.
Hooks integrate seamlessly into your component's logic flow. You call useToggle() and get back state and functions. Done.
When Render Props Still Shine
Render props excel when you need to customize what gets rendered, not just share logic. If your reusable component must wrap children with specific markup, positioning, or styling that varies per use case, render props give consumers full control over the render output.
Think of a tooltip library: the tooltip positioning logic is reusable, but what goes inside the tooltip varies wildly. A render prop lets each consumer dictate their exact JSX structure while the component handles the hard parts (positioning, visibility, events).
Animation libraries often use render props to expose interpolated values that consumers transform into any visual output they need.
The Mental Model
Hooks = logic extraction. Get values, use them however you want.
Render props = render customization. The component controls when and where things render; you control what renders.
Key Takeaway: Hooks replaced render props for sharing stateful logic, but render props remain valuable when the goal is giving consumers fine-grained control over rendering structure and output.