<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>bookreadkun</author_name>
  <author_url>https://blog.hatena.ne.jp/bookreadkun/</author_url>
  <blog_title>おーみんブログ</blog_title>
  <blog_url>https://oooomincrypto.hatenadiary.jp/</blog_url>
  <categories>
    <anon>React</anon>
  </categories>
  <description>はじめに 基本的にuseStateで定義した変数の値を変更する際はsetStateを用いますが、値が変更されない事象がありました。 調べたところReactの仕様っぽかったので備忘録の粒度ではありますが記載したいと思います。 zenn.dev 内容 以下のようなコードの場合、setState後も値は変更されません(正確には一つ前の値が入ります)。 const [date, setDate] = useState&lt;Date&gt;(new Date()); const handleChange = (newDate: Date) =&gt; { setDate(newDate); // dateの値がnewD…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Foooomincrypto.hatenadiary.jp%2Fentry%2F2022%2F08%2F19%2F173637&quot; title=&quot;【React】useStateでsetState後に値が更新されない事象の対応方法 - おーみんブログ&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>2022-08-19 17:36:37</published>
  <title>【React】useStateでsetState後に値が更新されない事象の対応方法</title>
  <type>rich</type>
  <url>https://oooomincrypto.hatenadiary.jp/entry/2022/08/19/173637</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
