Think in React by Breaking Your UI into Components

Chris Achard
InstructorChris Achard
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

Every UI on the web can be thought of as a tree of "components".

Break down your UI in your mind by separating out "like" components. Those are what you'll turn into React components for displaying your data.

Chris Achard: [0:00] The key UI paradigm in React is components. Everything we're going to break into custom components, and then display that on screen. Here we have a TodoList and we wrap the whole thing in a container. Then we have a SearchBar, which is separate from the TodoList itself. Inside the TodoList there are four TodoItems.

[0:19] Within those components then, we also have the base HTML components. We have text inputs and checkboxes and strings. Those are part of our tree as well.

[0:30] In our sample app so far, we only have a <div> with an <h1> inside of it, but we can build a tree like this, and now we've created a tree of base HTML components which make up our entire React application.

egghead
egghead
~ 27 seconds ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today