import { useState } from 'react';
import CounterContext from './CounterContext';
import ShowCounter from './ShowCounter';

const App: React.FC = () => {
  const [counter, setCounter] = useState(0);

  function increment() {
    setCounter((prevState) => prevState + 1);
  }

  return (
    <CounterContext value={counter}>
      <ShowCounter />
      <button onClick={increment}>increment</button>
    </CounterContext>
  );
};

export default App;

