react-with-providers
v1.0.2
Published
HOC for React to relieve Provider Hell
Readme
react-with-providers
HOC for React to relieve Provider Hell
📖 Example
import withProviders from "react-with-providers";
export function Component() {
return (
<ProviderA>
<ProviderB>
<ProviderC>
<ProviderD>
<InnerComponent />
</ProviderD>
</ProviderC>
</ProviderB>
</ProviderA>
);
}
export const Component = withProviders(
[<ProviderA />, <ProviderB />, <ProviderC />, <ProviderD />],
InnerComponent
);
export const Component = withProviders(
[<ProviderA />, <ProviderB />, <ProviderC />, <ProviderD />],
function InnerComponent() {
// return Some JSX...
}
);