From 7c4e13d11bc2fc5b0f03efc959dd551a30565e8a Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Thu, 2 Jan 2020 17:20:23 +0300 Subject: Create Scoreboard component & integrate with API --- src/components/Scoreboard/Scoreboard.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/components/Scoreboard/Scoreboard.js (limited to 'src/components/Scoreboard/Scoreboard.js') diff --git a/src/components/Scoreboard/Scoreboard.js b/src/components/Scoreboard/Scoreboard.js new file mode 100644 index 0000000..1ebca90 --- /dev/null +++ b/src/components/Scoreboard/Scoreboard.js @@ -0,0 +1,28 @@ +import React, {useEffect, useState} from 'react'; + + +import { get } from "../../requests"; +import Solution from "./Solution"; + + +const Scoreboard = () => { + const [solutions, setSolutions] = useState([]); + + const updateSolutions = async () => { + const response = await get('solutions/'); + await setSolutions(response.data); + }; + + useEffect(() => { + updateSolutions(); + }, []); + + + return ( +
+ { solutions.map(solution => ) } +
+ ); +}; + +export default Scoreboard; \ No newline at end of file -- cgit v1.2.3