かもメモ

自分の落ちた落とし穴に何度も落ちる人のメモ帳

react-router-dom

React Hooks React-router-dom ページ遷移した時にページのスクロール位置をリセットしたい

React-router-dom を使うと簡単に SPA のルーティングができたのですが、スクロールした状態でページが切り替わると元のスクロール量が残り切り替わったページもスクロールされた状態で描画されしまう問題に直面ました。 windowのスクロールは、VDOMの世界外…

React-router-dom の <Switch> で React does not recognize the `computedMatch` prop on a DOM element. な警告が出る

React-router-dom を使っナビゲーションを作っていた際に下記の warning が表示されてしまいました。 React does not recognize the `computedMatch` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spe…