Self-review: Create your own custom hook, usePrevious - Advanced React

Self-review: Create your own custom hook, usePrevious - Advanced React

  1. True or False: You code a custom hook when you want to avoid duplication.

    • True

    • False

  2. 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

  3. In the previous exercise, you were given a task to create your own custom hook, usePrevious. What was being returned from the usePrevious function declaration?

    • ref.current

    • ref

    • current