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 theusePreviousfunction declaration?ref.current
ref
current

About the author
A passionate full-stack developer from @ePlus.DEV
Comments
Join the discussionNo comments yet. Be the first to comment.
Advanced React
Learn how to use more advanced React concepts and features, become proficient in JSX, and confidently test your applications.






