Next.js Discord

Discord Forum

NPN React Component that uses a ref gets thus error in Next 14

Unanswered
Stripe-headed Tanager posted this in #help-forum
Open in Discord
Stripe-headed TanagerOP
I am getting this error in a custom component pulled from npm

if is complaining about the ref prop on the div - but it looks correct to me

here is the code for the component - is that a bug in React canary?

export function Test(props) {
const TestRef = useRef(null);
useEffect(() => {
(async () => {
console.log('TestRef.currrent', TestRef.current)
})();
}, [])
return (
<div ref={TestRef}>
test component
</div>
);
}

0 Replies