相关平台
支付宝小程序
小程序基础库: 2.7.23
使用框架: React
复现步骤
yarn 安装依赖
yarn dev:alipay 启动项目
使用支付宝开发小程序运行项目,出现错误
期望结果
项目能够实际运行
实际结果
TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')
at ensureRootIsScheduled (vendors.js:40863:1)
at scheduleUpdateOnFiber (vendors.js:40714:1)
at Object.updateContainer (vendors.js:44092:1)
at Root.render (taro.js:2110:1)
at Object.render (taro.js:2128:1)
at renderReactRoot (taro.js:665:1)
at createReactApp (taro.js:727:1)
at Module.srcAppTsx (app.js:5101:1)
at webpack_require (runtime.js:80:1)
at checkDeferredModules (runtime.js:46:1)
环境信息
👽 Taro v3.4.13
Taro CLI 3.4.13 environment info:
System:
OS: Windows 10
Binaries:
Node: 12.22.10 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
npm: 6.14.16 - C:\Program Files\nodejs\npm.CMD
9条答案
按热度按时间8ljdwjyq1#
@meiqinLiu Taro 升级到最新版本再试试
ds97pgxw2#
升级下react 版本
vojdkbi03#
我也遇到同样问题,不过问题在微信小程序里面。
taro 3.5.7
6mw9ycah4#
@ShawnZeng 版本都改成18.0.2
ycl3bljg5#
18.0.2
我试过18.2(不是18.0.2),也不行。我再试试这个。
vzgqcmou6#
补充一下。“我试过18.2(不是18.0.2),也不行。我再试试这个。”, 这个的话是错误不一样了。
Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.%s
Check the render method of
Index
.at view
at Index ( http://127.0.0.1:54756/appservice/pages/index/index.js:191:14 )
at root
at PageWrapper ( http://127.0.0.1:54756/appservice/taro.js?t=wechat&s=1667366667579&v=57675d1f0c618ec90004f4a73e836999:841:18 )
at Provider ( http://127.0.0.1:54756/appservice/vendors.js?t=wechat&s=1667366667579&v=e3e082be1b03d47ac3e3148405ff037b:63910:20 )
at App ( http://127.0.0.1:54756/appservice/app.js:107:27 )
at AppWrapper ( http://127.0.0.1:54756/appservice/taro.js?t=wechat&s=1667366667579&v=57675d1f0c618ec90004f4a73e836999:954:16)(env(env) : Windows,mp,1.06.2209190; lib: 2.27.0)
emeijp437#
装完18.2错是这个:.._src_runtime_connect.ts:372 Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
我正在根据这个检查。其实在我升级Taro之前没有错误。今天升级Taro后就开始出错了。
vwhgwdsa8#
补充一下。“我试过18.2(不是18.0.2),也不行。我再试试这个。”, 这个的话是错误不一样了。 Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.%s
Check the render method of
Index
. at view at Index ( http://127.0.0.1:54756/appservice/pages/index/index.js:191:14 ) at root at PageWrapper ( http://127.0.0.1:54756/appservice/taro.js?t=wechat&s=1667366667579&v=57675d1f0c618ec90004f4a73e836999:841:18 ) at Provider ( http://127.0.0.1:54756/appservice/vendors.js?t=wechat&s=1667366667579&v=e3e082be1b03d47ac3e3148405ff037b:63910:20 ) at App ( http://127.0.0.1:54756/appservice/app.js:107:27 ) at AppWrapper ( http://127.0.0.1:54756/appservice/taro.js?t=wechat&s=1667366667579&v=57675d1f0c618ec90004f4a73e836999:954:16)(env(env) : Windows,mp,1.06.2209190; lib: 2.27.0)你这个是循环里面的组件没给 key, react 都会报的,不是taro 的原因
https://zh-hant.reactjs.org/docs/lists-and-keys.html
https://reactjs.org/docs/lists-and-keys.html#keys
xeufq47z9#
升级到React 18.2后,问题基本解决。上面那个问题,是 taroify@core的依赖问题。目前还有些错误。不过已经可以渲染出来了。