0

I'm wondering what is better approach?

For example if I have some icons that are used in components.

assets folder approach ( located in root/src/assets/....)

import ListItemIcon from '@assets/ListItemIcon'

const ListItem = (props) => {
   return <div><ListItemIcon/>{props.title}</div>
}

or public folder approach ( located in root/public/....)

import Image from 'next/image'

const ListItem = (props) => {
  return <div><Image src='/ListItemIcon.png'/>{props.title}</div>
}

What are advantages / disadvantages in each approach while using nextjs framework? Is it different than working with pure react?

I don't have a clue what differences are there. I will be grateful for explanation.

MarekFodor
  • 21
  • 2
  • The difference is that only the files located inside `public` folder will be served as static files by Next.js. – ivanatias Nov 08 '22 at 05:54
  • @ivanatias Does that mean less bundle size right? So it will just mean that images will be loaded little slower as oposed to assets folder approach where images will be loaded with html? – MarekFodor Nov 08 '22 at 06:14

0 Answers0