aboutsummaryrefslogtreecommitdiff
path: root/src/index.tsx
blob: 9b740f9482fa87b4cd8fd81c40a87eb51c27d98d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 = () => {
  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';
ReactDOM.render(<App />, document.getElementById('root'));