score:0
in addition to mayank's answer above i would suggest you to use 'babel-root-import' plugin which will help you to import and require with root based path.
eg: from your homepage you can access signuploginform as below:
import signuploginform from '~/container/signuploginform';
for more details refer https://www.npmjs.com/package/babel-root-import
score:3
use this:
import signuploginform from '../../container/signuploginform';
since your container
folder is two level up from the homepage.jsx
file you need to use ../
twice.
meaning of ./
, ../
-
./
means the current directory, which means stay in the current folder and search for the file in this.
../
means the parent of the current directory/file, means go to one level up and search for the file.
for example lets say you have two files file1.js
and file2.js
at these paths, you want to import file2 from file1, imagine your folder structure as tree data structure :
case 1.
file1
-> a/b/c/file1.js
file2
-> a/b/c/file2.js
since files present in the same folder u can directly import it like this : ./file2.js
.
case 2.
file1
-> a/b/c/file1.js
file2
-> a/b/c/d/file2.js
in this case file2 present inside d
which is at the same level of file1
, you can import it like this: ./d/file2.js
.
case 3.
file1
-> a/b/c/file1.js
file2
-> a/b/file2.js
in this case file2
present at the parent level of file1
, so you need to go one step up by using ../
, like this: ../file2.js
case 4.
file1
-> a/b/c/file1.js
file2
-> a/file2.js
in this case file2
present at the level of parent of parent of file1
, so you need to go 2 step up by using ../
twice like this: ../../file2.js
.
simple rule: ./
means search in the same folder, ../
go one step up directry and search. we can use the combination also like: .././
Source: stackoverflow.com
Related Query
- How to fix this error : " Module not found :can't resolve popper.js "
- "module not found : Error: Cannot resolve module 'react/lib/ReactMount' "
- Cannot resolve module "firebase" from 'firebase.js' : Firebase could not be found within the project
- Error in Entry Module not found - in Webpack Config file
- How to resolve module not found error in webpack/reactjs app?
- webpack: ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' .jsx
- How to fix Next.js Vercel deployment module not found error
- cannot evaluate module 'react-native-maps' : Configuration with name 'default' not found
- Module not found Error when deployed on Heroku
- Error after update: Cannot resolve module 'react/lib/ReactMount'
- Typescript Module not found Can't resolve
- Module not found Error: Can't resolve 'history' in @types/history
- Module not found: Error: Cannot resolve module 'fs'
- Module not found when import .jsx file
- Module not found: Error: Cannot resolve module 'react-addons-test-utils'
- Firebase-Admin, importing it to react application throws Module not found error
- React: Flow: Import a local js file - cannot resolve issue module
- why do i get the Error Module not found: Can't resolve 'redux'
- Module not found: Error: Cannot resolve module 'react-redux'
- Module not found error using Yarn 2 to link React components
- Module not found: Error: Cannot resolve module 'react' when I use webpack
- ERROR in Entry module not found: Error: Can't resolve 'babel-loader'
- Module not found: Error: Cannot resolve module 'routes'
- I cannot understand " Module not found: Error: Can't resolve 'fs' '"
- Error no Jest: This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript
- Webpack: ERROR in ./src/index.tsx Module not found: Error: Can't resolve './App' in '...'
- getting error : Could not find a declaration file for module 'react-bootstrap-modal'. in react js
- how to solve the error that fs module is not found when used react and next.js
- Module not found: Error: Cannot resolve module 'components/app'. webpack + reactjs issue
- `react-map-gl` ERROR Module not found error [MAPBOX]
More Query from same tag
- Display article content with matching url's in react.js
- Dependency is not renamed
- How to define a custom function to rowClick in react-admin datagrid?
- How to trigger react for radio input in Bigcommerce optimized checkout
- React Hooks: array not updating/changing in useEffect Hook
- react-router-dom link to another page
- node js server post request ignores square brackets "[]" sent from axios what should I do?
- Jest Enzyme unit test axios api services with coverage
- Create date headers similar to reputation changes using React js
- how to setState an array which is nested inside an array of objects
- When I click on button to edit my value, the state don't update the input value
- Removing a object from array state ReactJS
- Child Component doesn't rerender when state of parent component changes
- Styling position of props in React Component
- Why is my call to (mobx) extendObservable not triggering a re-render?
- State isn't getting update correctly React
- Implantation of counter in react has a value of 0 when I reference in an empty useEffect
- Why "gulp-jest" is failing with: "Please run node with the --harmony flag!"?
- After sync on gitlab code unable to compile and show no error in files but on webpage
- How to delay data from useContext
- Modify object while passing through react component
- Use getusermedia media devices in reactJS to record audio
- Autodesk React Forge problem with forge-dataviz-iot-react-components in a empty project
- Mocking a Class from NPM Module with Jest, giving me a Constructor issue
- Array.find function in REACT JS Cannot read property of undefined
- Input data given to 'points' is not a valid GeoJSON object
- how to pass urls, params, headers to call() in redux-saga?
- Simple font size changer with Material UI slider and React
- React-dnd Components not working correctly in Storybook
- I have a problem array.map() method it loops so many times every time i call that in React