我正在开发一个 next.js 项目,我想在其中使用 framer-motion。我刚刚开始这个项目,在安装和使用成帧器运动时遇到问题。我正在尝试创建一个简单的motion.div 组件并在另一个组件中使用它。
ERROR I get in the terminal while running "npm run dev" :
./node_modules/framer-motion/dist/es/animation/hooks/use-animated-state.mjs
Attempted import error: 'useState' is not exported from 'react' (imported as 'useState').
我正在使用以下库/包:
我尝试降级framer-motion版本,但不起作用。如果有人能帮忙那就太好了。
谢谢。
我通过将“使用客户端”添加到我需要framer-motion api的组件中解决了这个问题