<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kikiki-kiki</author_name>
  <author_url>https://blog.hatena.ne.jp/kikiki-kiki/</author_url>
  <blog_title>かもメモ</blog_title>
  <blog_url>https://chaika.hatenablog.com/</blog_url>
  <categories>
    <anon>React</anon>
    <anon>React Hooks</anon>
    <anon>JavaScript</anon>
    <anon>TypeScript</anon>
    <anon>ESLint</anon>
  </categories>
  <description>Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement. というエラーに出会ったのでメモ。 環境 React ^17.0.1 エラーが発生した経緯 ロード中と完了後に別のコンポーネントを表示したいとか、状態が違う時に別のコンポーネントを表示したいとか JSX 内に分岐がある箇所に Hooks を使うとエラーになるっぽい。 エラーの再現ができなかったのですが、map でループして表示させているコンポーネントを条件分岐させて、片方で …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fchaika.hatenablog.com%2Fentry%2F2021%2F05%2F08%2F083000&quot; title=&quot;React 条件分岐のある箇所で Hooks を使うとエラーになる - かもメモ&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>https://m.media-amazon.com/images/I/31mlQdSKNYL._SL500_.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-05-08 08:30:00</published>
  <title>React 条件分岐のある箇所で Hooks を使うとエラーになる</title>
  <type>rich</type>
  <url>https://chaika.hatenablog.com/entry/2021/05/08/083000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
