import { memo, useEffect, useState } from 'react';

type Props = {
  title: string;
};
const Headline: React.FC<Props> = memo(({ title }) => {
  console.log('render headline');
  return <h1>{title}</h1>;
});

const App: React.FC = () => {
  const [state, setState] = useState({ number: 0, title: 'Hello Memo' });

  useEffect(() => {
    setTimeout(() => {
      setState({ number: 1, title: 'Hello React' });
    }, 1000);
    setTimeout(() => {
      setState({ number: 2, title: 'Hello React' });
    }, 2000);
  }, []);
  return <Headline title={state.title} />;
};

export default App;

