Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react axios request data objest from online json with table element

// this is the component of the GetResponds.js
import React from 'react';
 
import axios from 'axios';

export default class PersonList extends React.Component {
    state = {
        persons: [ 
            

    ]
        
    }
    componentDidMount() {
            axios.get('https://jsonplaceholder.typicode.com/users')
            .then( res => {
                const persons = res.data;
                this.setState({ persons });
            })

    }
    render(){
        return(
            <table>
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Username</th>
                    <th>Email</th>
                </tr>
            </thead>
            <tbody>
                {this.state.persons.map((person) =>
                    <tr>
                        <td>{person.id}</td>
                        <td>{person.name}</td>
                        <td>{person.username}</td>
                        <td>{person.email}</td>
                    </tr>)}
            </tbody>
        </table>

        )
    }
}   
Comment

PREVIOUS NEXT
Code Example
Javascript :: Backbone Models In Collection Is Added Here 
Javascript :: generate qr codes js 
Javascript :: Changing Prototype 
Javascript :: Error: Minified React error #321 
Javascript :: Html() is a JQuery Function 
Javascript :: Simplest Template Example 
Javascript :: js watchFile 
Javascript :: numberformat chakra 
Javascript :: angularjs $q all hash 
Javascript :: como contar los checkbox jquery 
Javascript :: node-fetch retry 
Javascript :: payflex api examples php 
Javascript :: nextjs youtube embed 
Javascript :: convert html table to pdf 
Javascript :: jsx children 
Javascript :: VM1658:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0 
Javascript :: javascript interview questions geeksforgeeks 
Javascript :: double exclamation mark javascript 
Javascript :: window handles 
Javascript :: stack overflow multiselect error react 
Javascript :: nodejs version abfragen 
Javascript :: $( ) jquery 
Javascript :: nodejs mysql Getting the number of affected rows 
Javascript :: how to set maxLength of input type number in react 
Javascript :: mongoose auto delete after time 
Javascript :: how to hide javascript code from client 
Javascript :: Angularjs different dependency injection for factories inside controller 
Javascript :: angularjs getting Error: [$rootScope:inprog] $digest already in progress when changed from Fetch to $http + $q 
Javascript :: how to set a condition so that between the first and second mouse clicks there was a delay not 500mls 
Javascript :: How to use search/filter for HTML Divs generated from JSON data using JavaScript 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =