When Lazy Init is Overkill
You'll learn: When the lazy initialization syntax actually hurts readability without providing any performance benefit.
The Core Idea
Lazy initialization exists to skip expensive operations on every render. But wrapping simple values in a function adds visual clutter and cognitive overhead. If your initial state is a primitive (number, string, boolean) or a cheap operation, lazy init is overkill.
Simple Values Don't Need Functions
When you write useState(0), React reads that 0 once on mount. It's already fast—there's no computation to skip. Wrapping it in a function makes the code harder to read:
// Overkill: unnecessary function wrapper
const [count, setCount] = useState(() => 0);
// Better: just pass the value
const [count, setCount] = useState(0);
Both run the initialization only once. The function syntax provides zero benefit for primitives.
When Direct Values Are Already Cheap
Even some operations that look like they're doing work are actually trivial:
// Overkill: simple string concatenation is fast
const [name, setName] = useState(() => "User" + "123");
// Better: this is already cheap
const [name, setName] = useState("User123");
// Overkill: empty array is instantaneous
const [items, setItems] = useState(() => []);
// Better: cleaner and just as fast
const [items, setItems] = useState([]);
Creating an empty object or array is not expensive. Save lazy init for actual work: parsing JSON, filtering large arrays, reading files, etc.
The Rule of Thumb
If you can't explain why the initialization is slow, you don't need the function form.
Key Takeaway: Lazy initialization is for skipping expensive work; wrapping primitives or simple literals in functions just makes your code harder to read without any performance gain.