LoginSignup
0
0

More than 1 year has passed since last update.

【Next.js】useEffectが2回実行されてしまう

Posted at

環境

OS: MacOS Ventura 13.0.1
Node.js: v17.0.0
next: 13.0.3
react: 18.2.0

起きていた問題

nextの基礎学習をしていて、ステートの値をテーブルに出力したところ、同じデータが2回繰り返されていました。
(ソース割愛)

解決した方法

next.config.jsにこれを追加、変更する。

//next.config.js
const nextConfig = {
  reactStrictMode: false,//これを追加
};

開発環境でしか起きないようですが、気持ち悪いので変えときます。

参考にしたページ

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