admin管理员组文章数量:1415673
I get this error on my next js app and I don't even know why or where its ing from since the code that's throwing the error is not even written by me.
error - file:///Users/cheq/Desktop/cheqo/node_modules/framer-motion/dist/es/ponents/AnimatePresence/use-presence.mjs:1
import { useContext, useId, useEffect } from 'react';
^^^^^
SyntaxError: Named export 'useId' not found. The requested module 'react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'react';
const { useContext, useId, useEffect } = pkg;
I get this error when I import anything from framer motion, here is my full code:
import React from 'react';
import { motion } from 'framer-motion';
function motionpage() {
return (
<>
<div>motionpage</div>
<motion.button whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }}>
Button
</motion.button>
</>
);
}
export default motionpage;
How can I fix this?
I get this error on my next js app and I don't even know why or where its ing from since the code that's throwing the error is not even written by me.
error - file:///Users/cheq/Desktop/cheqo/node_modules/framer-motion/dist/es/ponents/AnimatePresence/use-presence.mjs:1
import { useContext, useId, useEffect } from 'react';
^^^^^
SyntaxError: Named export 'useId' not found. The requested module 'react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'react';
const { useContext, useId, useEffect } = pkg;
I get this error when I import anything from framer motion, here is my full code:
import React from 'react';
import { motion } from 'framer-motion';
function motionpage() {
return (
<>
<div>motionpage</div>
<motion.button whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }}>
Button
</motion.button>
</>
);
}
export default motionpage;
How can I fix this?
Share Improve this question asked Oct 20, 2022 at 21:59 Ripas55Ripas55 9631 gold badge17 silver badges29 bronze badges 1- It was a pretty long time ago, but maybe you remember what was the solution? I am experiencing exactly the same problem with framer-motion – Phelizer Commented Nov 9, 2023 at 17:06
1 Answer
Reset to default 6useId
is a new hook introduced in React 18. Upgrade your react version and try again.
本文标签:
版权声明:本文标题:javascript - framer motion crashes next js app with the following error: "SyntaxError: Named export 'useId& 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745203113a2647494.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论