mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This PR introduces breaking changes by renaming components. - Rename `next/image` to `next/legacy/image` - Rename `next/future/image` to `next/image` The diff is very confusing because both components are very similar so git got confused.
62 lines
1.4 KiB
JavaScript
62 lines
1.4 KiB
JavaScript
import React, { useRef } from 'react'
|
|
import Image from 'next/legacy/image'
|
|
|
|
const Page = () => {
|
|
const myRef = useRef(null)
|
|
|
|
return (
|
|
<>
|
|
<div
|
|
ref={myRef}
|
|
style={{
|
|
width: '100%',
|
|
height: '400px',
|
|
position: 'relative',
|
|
overflowY: 'scroll',
|
|
}}
|
|
>
|
|
<div style={{ width: '400px', height: '600px' }}>hello</div>
|
|
<div style={{ width: '400px', position: 'relative', height: '600px' }}>
|
|
<Image
|
|
id="myImage1"
|
|
src="/test.jpg"
|
|
alt="mine"
|
|
width="400"
|
|
height="400"
|
|
lazyBoundary="1500px"
|
|
/>
|
|
<Image
|
|
lazyRoot={myRef}
|
|
id="myImage2"
|
|
src="/test.png"
|
|
alt="mine"
|
|
width="400"
|
|
height="400"
|
|
lazyBoundary="1800px"
|
|
/>
|
|
<Image
|
|
lazyRoot={myRef}
|
|
id="myImage3"
|
|
src="/test.svg"
|
|
alt="mine"
|
|
width="400"
|
|
height="400"
|
|
lazyBoundary="1800px"
|
|
/>
|
|
|
|
<Image
|
|
lazyRoot={myRef}
|
|
id="myImage4"
|
|
src="/test.webp"
|
|
alt="mine"
|
|
width="400"
|
|
height="400"
|
|
lazyBoundary="200px"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
export default Page
|