Created
January 14, 2024 05:46
-
-
Save mbchoa/d3865c6989a55424900a3d2c65c7abab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function composeProviders(providers) { | |
return providers.reduce((AccumulatedProviders, [Provider, props = {}]) => { | |
return ({ children }) => ( | |
<AccumulatedProviders> | |
<Provider {...props}>{children}</Provider> | |
</AccumulatedProviders> | |
); | |
}, ({ children }) => <>{children}</>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment