Json Data Display with ReactJS | Indiantechnoera - IndianTechnoEra
Latest update Android YouTube

Json Data Display with ReactJS | Indiantechnoera

Json Data Display with ReactJS | Indiantechnoera

 





Student.json

[
    {"Name": "Sam","Branch": "CSE","Roll": "101"},
    {"Name": "Sid","Branch": "ECE","Roll": "942"},
    {"Name": "Edward","Branch": "CSE","Roll": "102"},
    {"Name": "Andrew","Branch": "Bio","Roll": "214"}
]

JsonDataDisplay.js


import JsonData from './Student.json'
import './JsonDataDisplay.css'
function JsonDataDisplay () {
  const DisplayData = JsonData.map(data => {
    return (
      <tr>
        <td> {data.Name} </td>
        <td> {data.Branch} </td>
        <td> {data.Roll} </td>
      </tr>
    )
  })
  return (
    <div>
      <table className='table'>
        <thead>
          <tr>
            <th>Name</th>
            <th>Branch</th>
            <th>Roll</th>
          </tr>
        </thead>
        <tbody>
            {DisplayData}
        </tbody>
      </table>
    </div>
  )
}

export default JsonDataDisplay;


JsonDataDisplay.css

table{ width: 250px;}
th{border: 2px solid black;background-color: rgb(18, 222, 151);color: white;}
td{border-bottom: 2px dotted rgb(137, 137, 137);}

index.js

import React from 'react'
import ReactDOM from 'react-dom/client'
import JsonDataDisplay from './JsonDataDisplay'

const root = ReactDOM.createRoot(document.getElementById('root'))
root.render(
  <>
    <JsonDataDisplay />
  </>
)

Output




Post a Comment

Feel free to ask your query...
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.