From 17cdcaed21bba89d934d83861eeeb998e977f967 Mon Sep 17 00:00:00 2001 From: hcampos Date: Thu, 27 Apr 2023 09:55:03 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20rename?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ScoreBoard/ScoreBoard.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/ScoreBoard/ScoreBoard.tsx b/src/components/ScoreBoard/ScoreBoard.tsx index 3454472..61d0b85 100644 --- a/src/components/ScoreBoard/ScoreBoard.tsx +++ b/src/components/ScoreBoard/ScoreBoard.tsx @@ -9,26 +9,26 @@ type ScoreBoardProps = { close: () => void } -interface Data { +interface Scores { name: string score: string } export const ScoreBoard: FC = ({ close }) => { - const [data, setData] = useState([]) + const [scores, setScores] = useState([]) useEffect(() => { const keys = Object.keys(localStorage) - const allData: Data[] = keys.map((key) => { + const allScores: Scores[] = keys.map((key) => { const value = localStorage.getItem(key) return { name: key, score: value as string } }) - setData(allData) + setScores(allScores) }, []) const removeScore = (name: string) => { - const filteredData = data.filter((item) => item.name !== name) - setData(filteredData) + const filteredData = scores.filter((item) => item.name !== name) + setScores(filteredData) localStorage.removeItem(name) } @@ -46,7 +46,7 @@ export const ScoreBoard: FC = ({ close }) => {
- {data.map((score) => { + {scores.map((score) => { return (