diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-05-04 13:15:33 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-05-04 13:15:33 +0300 |
commit | a0a7d00d30c9a057219c1dd6c7882c2d7fe21ae3 (patch) | |
tree | d08153b9cbdf6bd350090308aba009f218ab8401 /src/index.tsx | |
parent | 34cd013fd6d35e6e45bde65d6fe21622340b652f (diff) | |
download | chrono-cube-ui-a0a7d00d30c9a057219c1dd6c7882c2d7fe21ae3.tar.gz |
feat: register solution in timer
Diffstat (limited to 'src/index.tsx')
-rw-r--r-- | src/index.tsx | 18 |
1 files changed, 16 insertions, 2 deletions
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 (<Timer />); + const [author, setAuthor] = useState<string>('anonymous'); + const [solutions, setSolutions] = useState<Solution[]>([]); + + const registerResult = (result: string) => { + setSolutions([...solutions, { author, result }]); + } + + return ( + <Timer registerResult={registerResult} /> + ); }; document.body.style.overflow = 'hidden'; |