I have split my file containing a large number of functions into multiple files and want to have a common index.js file to export function from each file. How do I do that, using one line of code, or something similar to export * from "./something";
Asked
Active
Viewed 95 times
-1

Vishal Rathore
- 83
- 1
- 1
- 5
2 Answers
0
One way to do this would be to create index.js
file in the same dir as your functions and then export them like this
export { default as FuncOne } from "./FuncOne";
export { default as FuncTwo } from "./FuncTwo";
export { default as FuncThree } from "./FuncThree";
...
To make sure that this works, each function will need to be exported as default in each file as per the example below.
// FuncOne.js
const FunctOne = () => { ... };
export default FuncOne;

Mantas Astra
- 952
- 6
- 14
-1
no, there is not. old versions usually don't do what the new versions do, it is why they is call new versions

Ernesto
- 3,944
- 1
- 14
- 29