Skip to content
Snippets Groups Projects
Commit 438cde06 authored by Jean-Christophe's avatar Jean-Christophe
Browse files

modif persons data

parent 3f7b638c
No related branches found
No related tags found
No related merge requests found
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
// import stysheet defining style specific to this component
import '../assets/style/person.css'; import '../assets/style/person.css';
/*
* define a component that uses props, props is a javascript object
*/
const Person = ( { name = 'Anonymous', age, started, delay } ) => { const Person = ( { name = 'Anonymous', age, started, delay } ) => {
const [ currentAge, setCurrentAge ] = useState(age); const [ currentAge, setCurrentAge ] = useState(age);
......
...@@ -13,7 +13,7 @@ const PersonListing = props => { ...@@ -13,7 +13,7 @@ const PersonListing = props => {
const [persons, setPersons ] = useState([]); const [persons, setPersons ] = useState([]);
const fetchData = async () => { const fetchData = async () => {
const data = await mockFetch('http://source.of.data/persons',1000); const data = await mockFetch('http://source.of.data/persons',10);
setPersons( data ); setPersons( data );
} }
......
...@@ -8,6 +8,11 @@ const persons = [ ...@@ -8,6 +8,11 @@ const persons = [
id: 'A002', id: 'A002',
name: "Bilbo Baggins", name: "Bilbo Baggins",
age: 111 age: 111
},
{
id: 'A003',
name: "Frodo Baggins",
age: 33
} }
]; ];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment