From the course: React Foundations by Pearson
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Data-driven JSX - React.js Tutorial
From the course: React Foundations by Pearson
Data-driven JSX
Okay, so in this video, I'm going to show how to have data-driven user interface content used in JSX. The examples so far in this lesson have all been hard-coded lists. I've got a list of a Swansea shirt, and Cardiff shirt, and Lamborghini, and it's all fixed. In reality, you'll be using data to decide what to display. You have an array, for example, that will contain the items to be displayed, and somehow you've got to build content, and we're going to see how to do that using JSX. Based on the data, build content to be displayed. So what we do, basically an extension of what we already know, we use curly brackets to enclose JavaScript code in the middle of our sea of XML. We can have a little island of JavaScript. And inside the curly brackets, we can write as complicated JavaScript as we like to take some data and transform it into XML, which will then be converted into visual content by Babel. So here's an example, which we're going to pursue in this topic. I've got an array of…
Contents
-
-
-
-
-
-
(Locked)
Learning objectives1m 21s
-
(Locked)
Getting started with JSX6m 40s
-
(Locked)
Creating a simple user interface via JSX13m 27s
-
(Locked)
Evaluating JavaScript expressions in JSX7m 4s
-
(Locked)
Data-driven JSX10m 52s
-
(Locked)
Passing properties to a component via JSX12m 56s
-
(Locked)
Additional JSX techniques16m 44s
-
(Locked)
Lab: using JSX9m 47s
-
(Locked)
Lab solution: Using JSX5m 24s
-
(Locked)
-
-
-
-
-
-
-
-
-