Performance: Hook naming conventions
MEDIUM IMPACT
This affects how React identifies hooks during rendering, impacting component update correctness and rendering performance.
function MyComponent() { const data = useFetchData(); // Correct hook name return <div>{data}</div>; }
function MyComponent() { const data = fetchData(); // Missing 'use' prefix return <div>{data}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Incorrect hook naming | No direct DOM ops but causes React errors | Potential multiple re-renders due to errors | Blocks paint until error resolved | [X] Bad |
| Correct hook naming | Standard React DOM updates | Single reflow per state change | Smooth paint with no blocking | [OK] Good |