Dhiman_aman Posted on Jan 21 JSON maping in ReactJS #javascript #react #beginners #programming Create a JSON file with .js extension Data.js const JSONdata = [ { id: 1, quote: "Life isnβt about getting and having, itβs 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", }, ] Enter fullscreen mode Exit fullscreen mode 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; Enter fullscreen mode Exit fullscreen mode Finally Done !!! Oldest comments (0) Crown Sort discussion: Top Most upvoted and relevant comments will be first Latest Most recent comments will be first Selected Sort Option Oldest The oldest comments will be first Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Oldest comments (0)