Import a svg in Next.js

First option:

jsx
import logo from '../assets/logo.svg'

const Logo = () => {

    return <img src = {logo.src}/>

}

Second option:

jsx
import Image from 'next/image'
import logo from '../public/logo.svg'

const Logo = () => {

    return <Image src = {logo} height = {30} width = {30}/>

}

Hi, I'm Erik, an engineer from Barcelona.

If you like the post, say hi or join Substack to get non-frequent updates.