Home > database >  Can't use three dots to import in Reactjs?
Can't use three dots to import in Reactjs?

Time:07-25

I know I can write this to import a component from another file in the same folder

import component from "./component.js"

And to import a component from another folder but in the same folder

import component from "../component/component.js"

But how can I import from another folder like this

import component from ".../anotherComponent/component.js"

It seems React can't import with 3 dots.

CodePudding user response:

use 2dots for two time

"../../anotherComponent/component.js"
  • Related