re: React Beginner Question Thread ⚛ VIEW POST

re: Why not export a component that takes props? In your example, <Customer name="Dan" /> or <Customer name="Andrew" />. Then you can have ...

Actually I looked into compiled sources and is not bundling all variations.
Thanks for your reply!

Good to know! I guess webpack is smart enough to do the replacement earlier :-). This is still not a great future-proof approach because it relies on requires whereas the ecosystem has been moving to ES modules. It’s also much harder for any other tools to understand what’s going on in your modules.

code of conduct - report abuse