📌  相关文章
📜  未找到模块:无法解析 '. 'E:\UsamaComputer\frontend\src\components\navbar' 中的组件 SearchBar SearchBar' - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:51.052000             🧑  作者: Mango

代码示例1
. and .. are similar to how we use to navigate in terminal like cd .. to go out of directory and mv ~/file . to move a file to current directory.

my-app/
  node_modules/
  package.json
  src/
    containers/card.js
    components/header.js
    App.js
    index.js
In your case, App.js is in src/ directory while header.js is in src/components. To import you would do import Header from './components/header'. This roughly translate to in my current directory, find the components folder that contain a header file.

Now, if from header.js, you need to import something from card, you would do this. import Card from '../containers/card'. This translate to, move out of my current directory, look for a folder name containers that have a card file.