An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
January 21, 2023 07:20 pm GMT
Original Link: https://dev.to/raynecoder/json-maping-in-reactjs-1f84
JSON maping in ReactJS
- Create a JSON file with .js extension
Data.js
const JSONdata = [ { id: 1, quote: "Life isnt about getting and having, its about giving and being.", author: "Kevin Kruse", }, { id: 2, quote: "Whatever the mind of man can conceive and believe, it can achieve.", author: "Napoleon Hill", },]
App.js
import React from "react";import JSONdata from "../Data";const Home = () => { return ( <> {JSONdata.map((dataForMap) => { return ( <> <center> <h1>------------------</h1> <p>{dataForMap.id}</p> <p>{dataForMap.quote}</p> <h4>{dataForMap.author}</h4> </center> </> ); })} </> );};export default Home;
Finally Done !!!
Original Link: https://dev.to/raynecoder/json-maping-in-reactjs-1f84
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To