The useX Naming Pattern
You'll learn the standard naming convention that makes custom hooks instantly recognizable and discoverable in React codebases.
Why Naming Matters
In the previous lesson, you learned that custom hooks must start with "use" for React's rules to apply. But there's more to it than just starting with those three letters—the rest of the name* matters too for code clarity.
The Pattern: use + Descriptive Name
The convention is simple: use followed by a descriptive noun or verb phrase that clearly states what the hook does or provides.
Good examples:
useCounter— manages a counter valueuseFetch— handles data fetchinguseLocalStorage— syncs state with localStorageuseToggle— manages boolean toggle stateuseDebounce— debounces a valueuseWindowSize— tracks window dimensions
Poor examples:
handleCounter— doesn't start with "use"use— not descriptiveuseIt— vague, tells you nothinguseDataFromAPI— too verbose,useFetchis clearer
Think Like a Developer
When you see useCart in someone's code, you immediately know: this is a hook, it follows React's rules, and it probably manages shopping cart logic. The name becomes documentation.
Compare this to a function called getCart() or cartHelper()—you'd have no idea whether those are regular functions, whether they can use hooks inside, or when to call them.
Key Takeaway: Name your custom hooks with use + a clear, descriptive word or phrase that immediately communicates its purpose. This convention makes your hooks discoverable, maintainable, and signals to other developers (and React's linter) that hook rules apply inside.