Question 4 of 10Pro Only
What are custom hooks in React, and what are the rules for creating them? Can you provide an example of a useful custom hook you would create?
Sample answer preview
## What Are Custom Hooks? Custom hooks are JavaScript functions that start with "use" and can call other hooks. They allow you to extract component logic into reusable functions. ```javascript // A custom hook extracts reusable logic.
custom hooksuse prefixhooks rulescode reusecomposition