React.js Tip: Re-Export Components From Index.tsx (Barrel Exports) #reactjs #reactjstutorial

preview_player
Показать описание
How to import components from different files in a single import statement.

📣 Follow Coding in Flow on social media:
Рекомендации по теме
Комментарии
Автор

Another thing to consider index.ts files (aka barrel files): Some libraries (Material UI) encourage importing individual components separately to enable code-splitting

aidenpham
Автор

be aware of circular dependencies, they will arise for sure if you don't think about how the reexported things depend on each other (if they are)

convulsion
Автор

in 10 sec!!, amazing explain, thank you very much.

Oubaida_Awaw
Автор

Tbh, I think I rather prefer 10 lines of imports than adding an extra layer of complexity (it's a nice pattern but imho, it introduces more disadvantages than the advantages it provides).

wtl
Автор

It's also possible to use dynamic from next to only import the components when they come into view port helping performance.

PostMeridianLyf
Автор

If index.ts contain alot of components, dose retriving from it in different places cost ?

fedirouatbi
Автор

Is import / export const Name better than export default ?
Export const will reduce deadcode and good for tree shaking riight ?

hyphamne
Автор

How do I make my vs code icon color green?

joe_j
welcome to shbcf.ru