ReactJs Components

Why hooks

  • why hooks
    • simplify code
      • previously for new comers to react, there was a need to learn what this means in javascript making the learning experience harder
    • make it more performant
  • useState
    • set as a prefix is a convention
  • useEffect
    • it is a side effect (pure vs impure functions)


- call hooks only from react function
- call hooks at the top level
- you can call multiple state or effects
- make multiple calls in sequence - [fetch data](
- used to make server request - advanced hooks
- useReducer 
	- The useReducer hook is best used on more complex data, specifically, arrays or objects.
- useRef
- [custom hooks](