another-multi-provider

1.0.0 • Public • Published

Another React Multi Provider

Clean up your deeply nested provider components!

Example

Transform your code from something that looks like this:

<AuthenticationProvider configuration={configuration}>
  <MuiPickersUtilsProvider utils={DateFnsUtils}>
    <ThemeProvider theme={theme}>
      <DialogProvider>
        <AnotherContextProvider>
          <Router>
            <App />
          </Router>
        </AnotherContextProvider>
      </DialogProvider>
    </ThemeProvider>
  </MuiPickersUtilsProvider>
</AuthenticationProvider>

to this:

<MultiProvider providers={[
  [AuthenticationProvider, { configuration }],
  [MuiPickersUtilsProvider, { utils: DateFnsUtils }],
  [ThemeProvider, { theme }],
  DialogProvider,
  AnotherContextProvider,
  Router,
]}>
  <App />
</MultiProvider>

Installation

npm install --save another-multi-provider

Usage

import MultiProvider from 'another-multi-provider';
 
<MultiProvider providers={[
  // providers...
]}>
  <App />
</MultiProvider>

Inspired by

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i another-multi-provider

Weekly Downloads

6

Version

1.0.0

License

MIT

Unpacked Size

5.21 kB

Total Files

4

Last publish

Collaborators

  • pzs