From dd622def55c52255493c467e2be2f8e3473a1256 Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Sun, 5 Jan 2020 03:13:24 +0300 Subject: Add DELETE as menu option to SolutionCard --- src/components/Scoreboard/Scoreboard.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/components/Scoreboard') diff --git a/src/components/Scoreboard/Scoreboard.js b/src/components/Scoreboard/Scoreboard.js index 48d3c8a..039b951 100644 --- a/src/components/Scoreboard/Scoreboard.js +++ b/src/components/Scoreboard/Scoreboard.js @@ -27,6 +27,10 @@ const Scoreboard = () => { await setSolutions(response.data); }; + const removeSolution = (id) => { + setSolutions(solutions.filter((solution => solution.id !== id))); + }; + useEffect(() => { updateSolutions(); }, []); @@ -39,7 +43,7 @@ const Scoreboard = () => { {solutions.map(solution => ( - + ))} -- cgit v1.2.3