0

Goal : I want to import my reducer.js file into my Payment.js file

Here is my folder structure:

enter image description here

I'm currently using import { getBasketTotal } from '../reducer' in my Payment.js file and I can't seem to get it working.

I know this is probably a simple issue but any help would be appreciated.

3
  • 1
    import { getBasketTotal } from '../../../reducer' Commented Sep 30, 2020 at 0:57
  • @polyglot can you please explain? Commented Sep 30, 2020 at 2:48
  • okay, It works? Commented Sep 30, 2020 at 2:49

1 Answer 1

1

if you use '../' it will go one up in your directory, in your case in the components directory. Doing so again will take you to the src directory where 'reducer.js' exists. So the import will be

import {getBasketTotal} from '../../reducer'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.