Created
January 3, 2022 17:54
-
-
Save dbredvick/dbdd0f8caafd2fd83a55c3252ed1a8e0 to your computer and use it in GitHub Desktop.
Next.js Image caching / correct headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- ✅ better caching | |
import imageSrc from '../public/images/image.png' | |
import Image from 'next/image' | |
return <Image src={imageSrc}/> | |
// --- ❌ worse caching | |
import Image from 'next/image' | |
return <Image src="/images/image.png"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment