I'm currently using the following versions of tools:
- React-Native 71
- React 18.2
- TypeScript 4.8.3
In JavaScript, we have the mechanism of named re-export and re-exporting all the content of a module. For instance:
// foo.tsconsole.log('JS see it')export const myFunc = () => {…}// index.tsexport * from 'foo'; // re-exporting everything// VSexport {myFunc} from 'foo'; // re-exporting only myFuncAfterwards, I use this function in another module:
// myComponent.ts...import {myFunc} from './index';myFunc();I've noticed that when I perform the re-export of all the content of the module 'foo', I see the logs that I invoke in the 'foo' module when the application starts. However, when I do a named re-export, the logs don't appear until the first time I call the re-exported function.
This reminds me of lazy-loading module behavior.
Could you please explain why this is happening?




