<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>matsutoba</author_name>
  <author_url>https://blog.hatena.ne.jp/matsutoba/</author_url>
  <blog_title>matsutoba’s blog</blog_title>
  <blog_url>https://matsutoba.hateblo.jp/</blog_url>
  <categories>
    <anon>React</anon>
  </categories>
  <description>windowにクリックイベントを登録して、クリックしたときにstateの状態によって処理を切り分けたいので、こう書いてみた。 import { useState, useEffect, useMemo } from &quot;react&quot;; export default function App() { const [id, setId] = useState(&quot;&quot;); const handler = () =&gt; { console.log(&quot;id&quot;, id); if (id === &quot;1&quot;) { console.log(&quot;OK&quot;); } else { console.log(&quot;NG&quot;); } }; …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmatsutoba.hateblo.jp%2Fentry%2F2024%2F02%2F07%2F182313&quot; title=&quot;Reactでのstateの変更とイベントの再登録について - matsutoba’s blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-02-07 18:23:13</published>
  <title>Reactでのstateの変更とイベントの再登録について</title>
  <type>rich</type>
  <url>https://matsutoba.hateblo.jp/entry/2024/02/07/182313</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
