Self-review: Create your own custom hook, usePrevious - Advanced React
True or False: You code a custom hook when you want to avoid duplication.
True
False
Let's imagine you code a custom hook, called for example useNext, on a separate file named useNext.js
What's the minimum requirement for the custom useNext hook to be a valid hook?
The custom hook should always return a value
The custom hook should use at least one built-in React hook
The custom hook should always receive a parameter
In the previous exercise, you were given a task to create your own custom hook,
usePrevious
. What was being returned from theusePrevious
function declaration?ref.current
ref
current