react18中使用swiper报错Cannot read properties of undefined (reading 'wrapperClass')

react18中swiper导致的报错

在nextjs中使用swiperjs,当升级react版本到18.x后,报错:

Cannot read properties of undefined (reading 'wrapperClass')

当前版本信息:

"next": "^12.1.7-canary.30",
"react": "^18.2.0-next-e531a4a62-20220505",
"react-dom": "^18.2.0-next-e531a4a62-20220505",
"swiper": "^7.4.1"

解决方案:通过设置next.config.js中的reactStrictMode : false

或者:

升级swiper到最新版本

"next": "^12.1.7-canary.30",
"react": "^18.2.0-next-e531a4a62-20220505",
"react-dom": "^18.2.0-next-e531a4a62-20220505",
"swiper": "^8.2.2"

关联错误信息

posted @   小菜菜爱吃菜  阅读(952)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
历史上的今天:
2017-06-09 通过git上传本地代码到github仓库
点击右上角即可分享
微信分享提示