10 Matching Annotations
  1. Oct 2019
  2. Sep 2019
    1. The equivalent ways in functional components using Hooks:In a state variable: useState or useReducer. Updates in state variables will cause a re-render of the component.In a ref: Equivalent to instance variables in class components. Mutating the .current property won’t cause a re-render.
  3. Aug 2019
    1. But what about useState? it used whenever we have some variable that whenever it changes, we want to re-render our component and show some new contents.
    1. I’m here to convince you that when wrapped in a 4 line custom hook, useState can be just as powerful as, if not more powerful than, useReducer when managing complex state.