I'm trying to keep my code (server and client side) as modular as possible and this requires a lot of importing and exporting, however I have an unanswered question.
I tried to search from here, I read topical blog posts and even watched few YT videos, but it's still not fully explained. I would love to avoid making this mistake 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 same
module as much as I want and it imports it only once?
- What if I need to
import React
to File3 too? Is it still smart enough to handle this situation?
I'm using Node, Babel and Webpack.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…