I am trying to keep my code (on the server and client side) as modular as possible, and this requires a lot of import and export, however I have an unanswered question.
I tried to search from here, I read thematic blog posts and even watched some YT videos, but this is still not fully explained. I would like to avoid this error right now and avoid rewriting my logic later.
File1
import React from 'react'; // do something
File2
import React from 'react'; // do something else
file3
import File1 from './file1'; import File2 from './file2'; // do something with both
- Is it smart enough? Can I import the same module as much as I want, and it imports it only once?
- What if I need
import React too, File3 ? Is it still smart enough to handle this situation?
I use Node, Babel and Webpack.
source share