From a0a7d00d30c9a057219c1dd6c7882c2d7fe21ae3 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 4 May 2022 13:15:33 +0300 Subject: feat: register solution in timer --- src/index.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/index.tsx') diff --git a/src/index.tsx b/src/index.tsx index 713039f..9b740f9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,11 +1,25 @@ -import React from 'react'; +import React, { useState } from 'react'; import ReactDOM from 'react-dom'; import './style.css'; import Timer from './components/Timer'; +interface Solution { + result: string; + author: string; +} + const App: React.FC = () => { - return (); + const [author, setAuthor] = useState('anonymous'); + const [solutions, setSolutions] = useState([]); + + const registerResult = (result: string) => { + setSolutions([...solutions, { author, result }]); + } + + return ( + + ); }; document.body.style.overflow = 'hidden'; -- cgit v1.2.3