View Code? Open in Web Editor
NEW
This project forked from sahar11/lighthouse-custom-hooks
HTML 5.39%
CSS 17.86%
JavaScript 76.75%
lighthouse-custom-hooks's Introduction
- Building your own Hooks lets you extract component logic into reusable functions.
- Custom hooks let us move repetitive or complex code out of our components
- Pulls "logic" out of your component not "visuals"
- You can think of Custom hooks as "helper functions" for React
- Custom hooks usually use other React hooks (useState, useEffect, etc)
- Normal helper functions cannot use Hooks. Only Custom Hooks can do that
- React Rule: React Hooks must start with the prefix "use"
- Multiple instances of the same custom hook do not share state
- A Custom Hook can return anything you want (value, array, object, function)
lighthouse-custom-hooks's People
Contributors