1.0.8 ⢠Published 5 months ago
react-combined-providers v1.0.8
react-combined-providers
A utility for combining multiple React Context Providers into a single component. This helps to keep your provider hierarchy clean and manageable.
Installation
You can install the package using npm or yarn:
npm install react-combined-providers
# or
yarn add react-combined-providers
Usage
Wrap your application with CombinedProviders, passing an array of your context providers:
import { CombinedProviders } from "react-combined-providers";
import { ThemeProvider } from "./contexts/ThemeContext";
import { AuthProvider } from "./contexts/AuthContext";
import { StoreProvider } from "./contexts/StoreContext";
const App = () => (
<CombinedProviders providers={[ThemeProvider, AuthProvider, StoreProvider]}>
<YourApp />
</CombinedProviders>
);
export default App;
Why use react-combined-provider?
š Simplifies context management ā No more deeply nested providers.
š Easy to extend ā Just add more providers to the array.
ā Lightweight & flexible ā Works with any React context providers.
License
This project is licensed under the MIT License.