reading-notes

Class 401.27

Notes

Readings

Thinking in React

  1. Summarize the five steps of thinking in react.

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.

State: A Component’s Memory

  1. What is one reason a local variable isn’t sufficient for managing a React component?

A local variable won’t cause a re-render when it changes, which is needed for components to display updated data.

  1. What is the argument to the useState hook, and what are the two parts of its return array?

The argument to useState is the initial state value. The return array contains the current state value and a function to update the state.

  1. How can Component A access state from Component B?

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.

Bookmark and Review

Keep these pages handy - they answer questions that show up regularly for this lab.

Things I want to learn more about

References