Check out How to set state and pass as property reactjs by JR. Here is an excerpt:
Say we have some state in our application
usernameand we want to pass it as a property to a subcomponent. Here is how you do it.
- Define the state you want to pass in your parent.
- Pass it to your child component
- Use it in your child
Here is the entire example.
Filed under: reactjs