search

Home  >  Q&A  >  body text

Cannot import objects from the current folder into another folder

I'm trying to import a file from another folder But getting this error

./src/components/Body/index.js
Module not found: Can't resolve '../../context' in '/home/workspace/reactjs/coding-practices/layoutBuilder/src/components/Body'

I've tried:

import ConfigurationContext from '../../context'
 import ConfigurationContext from './../context'

I want to import objects from context>ConfigurationContext.js in Body>index.js

Please help to solve this problem

P粉434996845P粉434996845269 days ago567

reply all(1)I'll reply

  • P粉551084295

    P粉5510842952024-04-05 00:17:35

    Try this

    import ConfigurationContext from './../../context/ConfigurationContext'

    Because you didn't mention the file name in the path.

    reply
    0
  • Cancelreply