Open3

react実装メモ

aGlnYWtpbg==aGlnYWtpbg==

UseEffect

UseEffect( 第2引数なし)

import { useEffect, useState } from "react";

const UseEffectNoArgs = () => {
  const [count, setCount] = useState(0);

  useEffect(() => {
    document.title = `${count}回クリック!`;
  });

  return (
    <>
      <p>{count}回クリックした</p>
      <button onClick={() => setCount(count + 1)}>クリック</button>
    </>
  );
};

export default UseEffectNoArgs;

codeSandBox