mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
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.
19 lines
300 B
JavaScript
19 lines
300 B
JavaScript
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>
|
|
)
|
|
}
|