From the course: Creating a Serverless Application Using React in AWS
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Load JSON as data in your React component - Amazon Web Services (AWS) Tutorial
From the course: Creating a Serverless Application Using React in AWS
Load JSON as data in your React component
- [Instruct] Let's go ahead and use our data. So we have what is going to look to our react application, a lot like data. It really doesn't care if it's from a JSON file, which this is, or if it's from a database which we're going to get to later. What we do have, is we have a variable called menu links data, that has JSON information in it. And it is organized in terms of links, each item has a class, in HRF and a text. So we can use that now within our UL, we're going to insert a couple of curly braces, which allows us to now write JavaScript. And we want to take our object, our menu links data and we're going to use the map function. So with map, what we can do is we can map from the information in menu links data, to a desired output format. And so for each item, we're just going to call it link because each item does represent a link. It has the class of the link, the atria for the link and the text of the link.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Build a site based on structured data2m 19s
-
(Locked)
Organize your app with components5m 27s
-
(Locked)
Challenge: Build a menu based on dynamic data2m 3s
-
(Locked)
Solution: Build a menu based on dynamic data8m 6s
-
(Locked)
Use JSON as a Mock for Dynamically-Loaded Data5m 24s
-
(Locked)
Load JSON as data in your React component4m 25s
-
(Locked)
Challenge: Convert your components to use dynamic data2m 13s
-
(Locked)
Solution: Convert your components to use dynamic data7m 38s
-
(Locked)
Always be deploying1m 35s
-
-
-
-
-