Home > Blockchain >  What is single dot and two dot in filename during import in react?
What is single dot and two dot in filename during import in react?

Time:02-25

I am using react and I have imports with code as follows: import Logo from './filename'; import Logo1 from '../filename';

CodePudding user response:

If your logo is in public folder then no need to put . or .. , just import '/logo.jpg'.

CodePudding user response:

./ means "starting from the current directory". . refers to the current working directory, so something like ./foo.bar would be looking for a file called foo.bar in the current directory. and, .. refers to the parent directory of the current directory. So ../foo.bar would be looking for that file one directory above the current directory.

  • Related