React Hooks

  • Hooks can only be called inside React function components.
  • Hooks can only be called at the top level of a component.
  • Hooks cannot be conditional
  • React-redux
    • useSelector – map state to props
    • useDispatch – map dispatch to props
  • The useState Hook can be used to keep track of strings, numbers, booleans, arrays, objects, and any combination of these!
  • The useEffect Hook allows you to perform side effects in your components.  Some examples of side effects are: fetching data, directly updating the DOM, and timers.  useEffect runs on every render. That means that when the count changes, a render happens, which then triggers another effect.
  • React Context is a way to manage state globally.  It can be used together with the useState Hook to share state between deeply nested components more easily than with useState alone.