State
In this part of the lab we will get familiar with create-react-app and making basic React components.
Section 1: Creating and Using State
In this section we start learning how to use state.
Activity
- Create an initial count in state in the constructor for autocounter
- Render that count
Video
Section 2: Lifecycle
There is a lifecycle to React components. Here we learn how to use it for our autocounter.
Activity
- Add the timer to your autocounter component an increment the counter.
- Extra: pass the interval time as props into the component so different autocounters can go at different speeds.
Video