Files
next.js/test/integration/link-ref-app/app/child-ref/page.js
Sebastian "Sebbie" SilbermannandGitHub e9cbf27208 Run link-ref tests in /app and /pages (#69564)
We need to handle ref cleanups in a way that is compatible with React 18 and 19.

Forking these into -pages (18) and -app (19).
Combining them into a single app lead to a different behavior with regards to preload.
2024-09-04 16:09:02 -07:00

20 lines
313 B
JavaScript

'use client'
import React from 'react'
import Link from 'next/link'
export default () => {
const myRef = React.createRef(null)
React.useEffect(() => {
if (!myRef.current) {
console.error(`ref wasn't updated`)
}
})
return (
<Link href="/" ref={myRef}>
Click me
</Link>
)
}