12 Matching Annotations
  1. Oct 2020
    1. We get a boilerplate-free API where shared state has the same simple get/set interface as React local state (yet can be encapsulated with reducers etc. if needed).
  2. Oct 2019
  3. 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.
  4. 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.