Skip navigation
❌ Avoid Provider wrapping hell in React.
0:00 / 0:21

❌ Avoid Provider wrapping hell in React.

George Moller

@_georgemoller117K followers

Visit on X
1,526 likesDownloadOriginal post

120,931 views

❌ Avoid Provider wrapping hell in React. ✅ Instead combine all your Providers using composition.

10 Comments

Comments from the original post on X (Twitter)

  • George Moller's profile picture

    @_georgemoller

    I've been working professionally with React for more than 8 years and I compiled all my knowledge into 100+ infographics and 70+ video tutorials just like this one. Check them out ↓

    10 likes

  • Stephen Burke's profile picture

    @bursteways

    This seems like a useless abstraction. You typically never need to touch that nest so adding all of that extra code to achieve the same result seems pointless. What am I missing?

    83 likes

  • Sarju's profile picture

    @sarjuhansaliya

    By doing this you are increasing lines of code, complexity and bug surface area and reducing readability and plus if you are using typescript, there will be lots of extra things to handle compare to original one.

    6 likes

  • Farley's profile picture

    @kfbfarley

    What are you closing exactly?

    4 likes

  • Paulo Barros's profile picture

    @paulohcbarros

    @fernandozabin @feokuma @AmorimRob

    3 likes

  • Chung Wei's profile picture

    @ChungWeiLeong

    This makes your code even harder to read and maintain, not to mention an unnecessary loop. Just move all providers into a separate component and call it a day.

    2 likes

  • احمد الشبيب's profile picture

    @ahmad_alshbeeb

    Love your tips George, but this one is not for me. Regardless of the unreadable code I had to create for our lord Typescript, but the App initial start seems to have an odd behavior now? It looks like its re-loading multiple times before it actually settles. Before and After 👇

    2 likes

  • Anthony Laflamme's profile picture

    @0x41_0x4C

    Clever

    1 like

  • allen.xyz's profile picture

    @hodor_halper

    Does this require order to be maintained in the array?

    1 like

  • MMILife's profile picture

    @life_mmi

    What's the pros and cons aside from readability?

    1 like