Next.js Discord

Discord Forum

Where should I be storing images when using them locally?

Unanswered
Wuchang bream posted this in #help-forum
Open in Discord
Wuchang breamOP
heyo got a question, where do you usually store images when using next js?

Usually I use the public folder and then use the <img> tag but I saw on the docs you should use their <Image>

I also read that instead of getting the image from /yourimage.png, you can import it in the file and then just use it like so

              <Image
                alt=""
                src={fiveStars}
                className="h-10 w-auto flex-none"
              />


So I was wondering where do you store these or do you just keep them in public still?
import fiveStars from '../../../public/images/5stars.png'

4 Replies

Wuchang breamOP
This is what my dir looks like
Yeah keep them in the public folder and then import them into your components
Wuchang breamOP
Ah okay brilliant thank you