react-component-pack
v1.0.1
Published
Say goodbye to provider hell with react-component-pack, a utility that allows you to group multiple components into a single one
Downloads
678
Maintainers
Readme
React Component Pack ·
Say goodbye to provider hell with react-component-pack, a utility that allows you to group multiple components into a single one
npm install react-component-pack
Usage
With react-component-pack
you can go from this:
function App() {
return (
<AuthProvider>
<DataProvider>
<AnotherDataProvider>
<WtfProvider>
<ThisIsGettingReallyBigProvider>
<OhMyGodTheresMoreProvider>
<FinallySomeRealComponents />
</OhMyGodTheresMoreProvider>
</ThisIsGettingReallyBigProvider>
</WtfProvider>
</AnotherDataProvider>
</DataProvider>
</AuthProvider>
);
}
To this:
import { createPack } from 'react-component-pack';
const ProviderPack = createPack(
AuthProvider,
DataProvider,
AnotherDataProvider,
WtfProvider,
ThisIsGettingReallyBigProvider,
OhMyGodTheresMoreProvider
);
function App() {
return (
<ProviderPack>
<FinallySomeRealComponents />
</ProviderPack>
);
}