From 0e06183ee46edaca44a4b2f74ef1ea0e8174c8a3 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 6 May 2022 18:25:20 +0400 Subject: feat: persist solutions to localStorage --- src/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 30d0f07..c6cab71 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom'; import './style.css'; import './fonts/Bitter-Regular.woff'; +import useLocalStorage from './hooks/useLocalStorage'; import Timer from './components/Timer'; interface Solution { @@ -12,7 +13,7 @@ interface Solution { const App: React.FC = () => { const [author, setAuthor] = useState('anonymous'); - const [solutions, setSolutions] = useState([]); + const [solutions, setSolutions] = useLocalStorage('solutions', []); const registerResult = (result: string) => { setSolutions([{ author, result }, ...solutions]); -- cgit v1.2.3