How React Works

Chris Achard
InstructorChris Achard
Share this video with your friends

Social Share Links

Send Tweet

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.