4
3

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.

React18に上げたら描画の更新がうまくいかなくなった件のメモ

Posted at

概要

React18に上げたタイミングで、storeで値を書き換えても、それが画面に伝播しない状態になった。
結論からいうと、不適切な場所でReact.StrictModeを使用していたのが原因であった。

修正箇所

修正前

  <Router basename={'cartagraph-gamebook'}>
    <React.StrictMode>
      <Provider store={store}>
        <App />
      </Provider>
    </React.StrictMode>
  </Router>

修正後

<Router basename={'cartagraph-gamebook'}>
    <Provider store={store}>
      <React.StrictMode>
        <App />
      </React.StrictMode>
    </Provider>
  </Router>

参考

react - strict mode
React開発環境ではなぜかコンポーネントが2回描画されるのか判った!

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?