reciosonny
12/22/2019 - 6:31 AM

componentHooks.js

componentHooks.js

function App() {

  const [initialized, setInitialized] = useState(false);
  const [clicked, setClicked] = useState(false);


  useEffect(() => {
    setInitialized(true);
  });

  return (
    <div className="App">
      {initialized && <h1>Initialized</h1>}
      <h1 onClick={() => setClicked(true)}>Please click me!</h1>
      {clicked && <h2>You clicked an object!</h2>}
    </div>
  );
}