Created
July 22, 2021 09:35
-
-
Save guillaumebdx/7f5a9941795e5e1a153c55aaa5ff9981 to your computer and use it in GitHub Desktop.
disp
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 './App.css'; | |
| import axios from "axios"; | |
| import DisplayTask from "./components/DisplayTask"; | |
| import {useState} from "react"; | |
| import {useEffect} from "react"; | |
| function App() { | |
| useEffect(() => { | |
| axios.get('https://localhost:8000/api/projects/1/tasks') | |
| .then((response) => response.data) | |
| .then((data) => { | |
| setTasks(data); | |
| }); | |
| }, []) | |
| const [tasks, setTasks] = useState(null); | |
| return ( | |
| <> | |
| <h1>Task</h1> | |
| {tasks && tasks['hydra:member'].map(task => ( | |
| <DisplayTask task={task} /> | |
| ))} | |
| </> | |
| ); | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment