React · Junior · Question 29 of 75

Why must a custom hook's name start with use?

Explanation

The use prefix is a convention that eslint-plugin-react-hooks and the React Compiler rely on. By itself it doesn't memoize anything. A function with no hooks inside shouldn't be named use... - it's a regular utility.

Further reading

Problem with a question

React · Junior · question 29

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz