Using swiperjs in nextjs, after upgrading the react version to 18.x, an error is reported:
Cannot read properties of undefined (reading ‘wrapperClass’)
Current version information:
"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"
Solution: Via the settings next.config.js
inreactStrictMode : false
or:
Upgrade swiper to the latest version
"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"
See More: Swiper crashing with React 18 + Strict Mode
Read More:
- [Solved] Cannot read properties of undefined (reading ‘ajax‘); Cannot read property ‘ajax‘ of undefined
- [Solved] swiper Error: The requested module ‘react’ is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export
- [Solved] react Error: Can‘t perform a React state update on an unmounted component
- Can’t read property ‘push’ of undefined [How to Solve]
- Vue error in render: “typeerror: cannot read property ‘length’ of undefined”
- [Solved] Vue + uniapp Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- Wechat program typeerror: a solution to cannot read property ‘SetData’ of undefined
- [Solved] Parcel Package Error: Cannot read property ‘length‘ of undefined
- [Solved] TypeError: Cannot read property ‘indexOf‘ of undefined at VueComponent.resetFields
- [Solved] Echarts Error: Cannot read property ‘init‘ of undefined
- [Solved] Using `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` environment variables. Valid values are “development”, “test”, and “production”. Instead, received: undefined.
- [Solved] VUE Use Filters Error: [Vue warn]: Error in render: “TypeError: Cannot read property ‘toFixed’ of undefined”
- [Solved] Vue Error: Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- React Hook “useState“ is called in function “xxx“ which is neither a React function component or
- [Vue warn]: Error in render: TypeError: Cannot read property ‘xxxx’of undefined
- cesium CLAMP_TO_GROUND Error Cannot read property ‘globe‘ of undefined
- Uniapp: TypeError: Cannot read property ‘apply‘ of undefined (H5 does not report an error, but the real machine runs with an error)
- NPM install -g create-react-app [How to Solve]
- Taro Use React Hooks Error: TypeError: Object(…) is not a function
- Attempted import error: ‘mobx-react‘ does not contain a default export (imported as ‘observer‘).