The five steps are to break the UI into a component hierarchy, build a static version in React, identify the minimal representation of UI state, identify where your state should live, and add inverse data flow.
A local variable won’t cause a re-render when it changes, which is needed for components to display updated data.
The argument to
useState
is the initial state value. The return array contains the current state value and a function to update the state.
Component A can access Component B’s state if it’s passed down as a prop, or if both components access shared state from a common ancestor or context.
Keep these pages handy - they answer questions that show up regularly for this lab.