1
votes

I want to import a file to /components/login/index from /actions/login but I am getting an error:

Failed to compile.

./src/components/login/index.js Module not found: Can't resolve './actions/login' in 'C:\Users\UserName\Desktop\AppName\src\components\login'

This is my file stream

enter image description here

and I want to import here enter image description here

1

1 Answers

1
votes

Are you using a named export, so:

export Login .........

or an export default, so:

export default Login;

The way you're importing Login component suggests you are not importing Login component as default.

Have you tried below?

import Login from './actions/login';

Addition based on the comment:

Components folder is an empty folder. To reach actions folder, your import should be like below:

import Login from '../../actions/login';