Learn React fast. This is a quick overview of how to use React core features compressed into one minute. Remember to pause the video if you need time to understand something!
This lesson is for React v16.8 or later.
To learn more about React and the rest of the features we haven't covered, visit the official website.
Rodrigo Pombo: [0:01] React provides a createDocument() function to declare what we want to render to the DOM. Instead of using createElement directly, you can use JSX. To create a component, you only need to write a function with a name that starts with a capital letter. Now, you can use that function in JSX.
[0:16] You can assign attributes and React will pass them to the component as parameters. Inside JSX, you use curly braces to wrap dynamic data. In fact, you can wrap any JavaScript expression. To add event listeners, you pass a function to the corresponding attribute.
[0:32] To add a state to a component, there's the useState() function from React. It gives you a function to update the state. When you call it, React will know it needs to re-render the component. To render a list, you can map each list item to an element using JavaScript.
[0:49] React only needs a unique key for each element to find out when something changes. If you want to compose components together, React passes the nested elements inside a special property called children.
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
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!