Last active
          January 31, 2021 16:14 
        
      - 
      
- 
        Save lmas3009/0cd38b7426b5263315cf4631b6e41e5e to your computer and use it in GitHub Desktop. 
    A Simple MERN Full Stack Application
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import React, { useState, useEffect } from 'react'; | |
| import axios from 'axios' | |
| function Main() { | |
| const [data,setdata] = useState([]) | |
| useEffect(() => { | |
| async function fetchData() { | |
| const res = await axios.get("https://user-details-mern.herokuapp.com/details") | |
| setdata(res.data) | |
| } | |
| fetchData() | |
| }) | |
| return ( | |
| <div className="Main"> | |
| <table> | |
| <tr> | |
| <th>Name</th> | |
| <th>FullName</th> | |
| <th>Address</th> | |
| <th>Phone Number</th> | |
| <th>Email Id</th> | |
| </tr> | |
| {data.map((item) => ( | |
| <tr> | |
| <td>{item.Name}</td> | |
| <td>{item.FName}</td> | |
| <td>{item.Address}</td> | |
| <td>{item.PhonNo}</td> | |
| <td>{item.Email}</td> | |
| </tr> | |
| ))} | |
| </table> | |
| </div> | |
| ) | |
| } | |
| export default Main; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment