0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[備忘録]Next.js13でLinkで飛んだときに表示されない

Posted at

結論

複数あるlayout.tsxでHTMLタグとBodyタグが複数あるとダメみたい

起きたエラー

next/linkで遷移すると画面に何も表示されない、だがリロードすると治る

調べたこと

ブラウザのdeveloperツールで以下のエラーがあった

Warning: You are mounting a new body component when a previous one has not first unmounted.
It is an error to render more than one body component at a time and attributes and children of these components will likely fail in unpredictable ways.
Please only render a single instance of <body> and if you need to mount a new one, ensure any previous ones have unmounted first.

英語わかんないのでそのままエラー文で調べるとSlackで質問を見つける
翻訳したものを引用すると

このようなエラー メッセージが表示された場合は、2 つの異なるレイアウト ファイルで html タグを使用しています。HTML タグは 1 つのレイアウト ファイルにのみ含める必要があります。

というわけで

結論

複数あるlayout.tsxでHTMLタグとBodyタグが複数あるとダメみたい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?