2
2

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.

MUI v5 TransitionでCannot read properties

Last updated at Posted at 2023-11-07

エラー内容から原因が導出できなくて多少迷ったのでメモ

MUI v5でTransition(Grow)を使っていたところ以下のエラーが発生
Cannot read properties of undefined (reading 'style')
GrowをZoomなどに変更してみても同様のエラー

原因は単純でTransitionの下に複数要素配置してしまっていた

          <Grow in={true}>
            <TableContainer ...>
            ...
            </TableContainer>
            <Button ...>戻る</Button>
            <Button ...>決定</Button>            
          </Grow>

親要素にまとめてあげることで解決

          <Grow in={true}>
+          <div> //React.Fragmentの方がいいと思います
            <TableContainer ...>
            ...
            </TableContainer>
            <Button ...>戻る</Button>
            <Button ...>決定</Button>            
+          </div>
          </Grow>
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?