aboutsummaryrefslogtreecommitdiff
path: root/src/components/Scoreboard/Scoreboard.js
blob: 1ebca90d41882bd6fee5e720e3273190f510b502 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 (
    <div>
      { solutions.map(solution => <Solution solution={solution}/>) }
    </div>
  );
};

export default Scoreboard;