Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
cannot find module in index.js

hi I have this error while trying to import components (im using flow type)

This is my ReloadScreenPayLater.component.js

/**
 * Reload Screen Component
 * @param {Props} onReload - reload Parameter
 * @return {React.Node} - return react component
 */
const ReloadScreenPaylater = ({ onReload }: Props): React.Node => (
  <ReloadScreen onReload={onReload} />
);

ReloadScreenPaylater.displayName = config.displayName;

export default ReloadScreenPaylater;

this is my export in ./src/Components/ReloadScreenPayLater/index.js when i highlight the export it shows the ReloadScreenPayLater.component.js it has the ReloadScreenPayLater

so when i tried to run the apps or snap test it shows this error

src/Screens/InOutPayLater/InOutPayLater.component.snap.test.js
  ● Test suite failed to run

    Cannot find module '../../Component/ReloadScreenPayLater' from 'src/Screens/InOutPayLater/InOutPayLater.component.snap.test.js'

      10 |   .mock('../../Components/InOutEmptyState', () => 'InOutEmptyState')
      11 | 
    > 12 |   .mock('../../Component/ReloadScreenPayLater', () => 'ReloadScreenPayLater');

what i want to achieve is to be able to import the component from this path '../../Component/ReloadScreenPayLater'

nb: it works just fine if import like this

import ReloadScreenPaylater from '../../Components/ReloadScreenPayLater/ReloadScreenPayLater.component';

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

For default export (i.e. export default ReloadScreenPaylater = ...), we should use this import style instead.

import ReloadScreenPaylater from '../../Components/ReloadScreenPayLater/ReloadScreenPayLater.component';

For named export (i.e. export const ReloadScreenPaylater = ...), then we should use the other named import style.

import { ReloadScreenPaylater } from '../../Components/ReloadScreenPayLater/ReloadScreenPayLater.component';
about 4 years ago · Juan Pablo Isaza Report

0

From ES6 and onwards, you need to get the default exports from their name instead of {default}

Use this:

import ReloadScreenPaylater from '../../Components/ReloadScreenPayLater/ReloadScreenPayLater.component';

Or if you have named export then use import { Exported Named Component } from 'path'

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!