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'));
