How React Works

Chris Achard
InstructorChris Achard
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

The React UI loop follows these steps:

  1. You have data
  2. That data gets displayed
  3. The data updates (by user input, or a fetch from the server, etc)
  4. The UI updates

The React "magic" is in step 4 - React automatically updates the UI based on your changing data in a performant way. That means you can focus on your data and UI layout, and NOT on how you would have to update the DOM to show those changes.

Chris Achard: [0:00] We're going to start with the React UI cycle, which is that you have data, either in your app or you fetch it from a server. You want the data to get displayed on the screen, so you write a React component to do that. The user then interacts with your website, which may cause the data to update. That is going to update the UI automatically.

[0:17] The beauty of React is that happens automatically after you define your components. Once we have a component that is defined by a function, it will be displayed on the screen with ReactDOM. The way we're going to write React will make it so that whenever the data updates, our component will automatically update in the browser.

egghead
egghead
~ 37 minutes 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