From the course: React: Components, Context, and Accessibility

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Rendering arrays

Rendering arrays - React.js Tutorial

From the course: React: Components, Context, and Accessibility

Start my 1-month free trial

Rendering arrays

- [Instructor] To get started, let's take a look at our exercise files. In chapter one lesson two, you'll find the HTML file set up and ready to go. We're going to be writing most of our code here not to get bogged down in JavaScript tooling, but to instead focus on these important concepts. The file is set up with Babel to compile ES.Next syntax and JSX into JavaScript that the browser can read. We're also going to include React and React dom. All of our code will be written here in this script tag where we've indicated that we're going to transpile, or compile everything that's inside of this script tag. Now in previous versions of React, we were only able to render one root element. In other words, everything had to be nested inside of one tag. In React 16, we can render arrays. So let's take a look at what this might look like. The first step is we're going to use react dom without render. We're going to render this component called greetings. And this component should be mounted…

Contents