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

140
Views
React Native import or include JS file

if i have more than 300 Functional Components file that i need to import in a file called "main.js",and instead of adding 300 lines of imports like so :

import C1 from "./pages/C1";

.

.

.

import C300 from "./pages/C300";

i want to put those 300 imports in an external file called "myImports.js" ,then include/import this "myImports.js" in "main.js"

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

0

Alternatively you can do the better approach is to create a new folder like components and put all 300 files in it and create new file there name like index.js and copy the code below there like

import C1 from "./pages/C1";
.
.
import C300 from "./pages/C300";

export {
  C1,C2,...C300
};

Your components folder structure like

> components
    ----- C1.js
    ----- C2.js
    .
    .
    ----- C300.js
    ----- index.js // new file create here

Usage like

import { C300 } from "./components";
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!