Closed HandsomeBrother closed 1 year ago
@HandsomeBrother 请提供一个可以复现问题的项目
@devilwjp https://github.com/HandsomeBrother/veaury-demo 1: npm i 2: npm run build 3: cd hello-world 4: npm i 5: npm run serve 6: open console
@HandsomeBrother 你的项目我跑过了,你的react组件把整个react的包也打进去了,然后引入vue项目时,veaury又引了react,产生了react多例,就会出现这个警告 正确的做法,react组件打包之后,不应该把react也打进去
要确保hooks可以正常的使用,整个项目中只能存在唯一的一个react单例,这个是react的规范,你的这个react组件,即便被其他react项目使用,也会报这个警告的
感谢,我完善了一下demo,通过npm包提取veaury apply方法场景的webpack相关配置,https://github.com/HandsomeBrother/veaury-demo 可供遇到相同问题的同学参考
vue中使用react hooks组件需要什么配置吗,直接使用applyPureReactInVue报错了
代码