Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed React by Example!
You have completed React by Example!
Preview
We know how components will nest inside of one another in our app, and where the state will live. In this video, we'll start writing the initial state object for the App component.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Now, we'll start writing the initial
state object for the app component.
0:00
I'll open the main app component
in the text editor, and
0:01
I'll declare a state
object inside a class.
0:05
You might have seen state created
inside a constructor function before.
0:09
Well, create-react-app
lets us simplify our code,
0:14
letting us use property initializers and
classes like this.
0:16
Check the teacher's notes for more
information if you're curious about that.
0:20
Well, we know we'll need to track guests,
right?
0:23
After all, this app is for
keeping track of guests.
0:26
So in a way, it seems like the perfect
way to store lists of guests.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up