关于是否应该将某个变量作为state
文章目录

React: 关于是否应该将某个变量作为state.md

  1. Is it passed in from a parent via props? If so, it probably isn’t state.
  2. Does it remain unchanged over time? If so, it probably isn’t state.
  3. Can you compute it based on any other state or props in your component? If so, it isn’t state.