Skip to content

Instantly share code, notes, and snippets.

@louisrli
Created May 21, 2020 13:39
Show Gist options
  • Save louisrli/ea6182b7ac913360d1fddbd9d16d5fb8 to your computer and use it in GitHub Desktop.
Save louisrli/ea6182b7ac913360d1fddbd9d16d5fb8 to your computer and use it in GitHub Desktop.
Props and State: Teach each other
# React Props and State
## Learning Goal
At the end of this activity, you should understand what props and state are and know how to use them. How? You'll teach each other!
You'll be in pairs.
* **Person 1:** Responsible for props
* **Person 2:** Responsible for state
## Requirements
### Person 1: Props
Create a component (your choice in making whatever you want) that has two required props and one optional prop. The optional prop should be optional because it has a default value.
* Use this component at least three times, once with the default prop unset
### Person 2: State
Create a component (your choice in making whatever you want) that has three state variables that are set to initial values.
Make an element which, on click, somehow modifies one of the state variables.
**Bonus:** Pass a state variable as a prop to another child component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment