# react-tree-provider

> Simple component for working with Nested Providers

Latest version **1.0.8** (published 2023-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-tree-provider
pnpm add react-tree-provider
yarn add react-tree-provider
bun add react-tree-provider
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2023-12-19 |
| First published | 2023-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alexandre Gouget |
| Maintainers | alex.tomasz |
| Keywords | react, providers |

## Links

- npm: https://www.npmjs.com/package/react-tree-provider
- Repository: https://github.com/AlexGouget/React-tree-provider
- Homepage: https://github.com/AlexGouget/React-tree-provider#readme
- Issues: https://github.com/AlexGouget/React-tree-provider/issues
- npm.io page: https://npm.io/package/react-tree-provider

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2023-12-19
- 1.0.7 — 2023-12-19
- 1.0.6 — 2023-12-19
- 1.0.5 — 2023-12-19
- 1.0.4 — 2023-12-19
- 1.0.3 — 2023-12-19
- 1.0.2 — 2023-12-19
- 1.0.1 — 2023-12-19
- 1.0.0 — 2023-12-19

## README

# React tree provider 🌲

`React Tree Provider` is a lightweight React utility for efficiently managing nested context providers. It simplifies the process of embedding multiple context providers in your component tree, thereby reducing boilerplate and improving code readability.

## Installation

Install the package using npm:

```bash
npm install react-tree-provider

# or

yarn add react-tree-provider
```


## Usage

Here's a basic example of how to use rtp in a React application:

```jsx
import React from 'react';
import {ReactTreeProvider} from "react-tree-provider";
import { UserProvider, ThemeProvider } from 'your-context-providers';

export default function MyApp({ Component, pageProps }) {
    const Providers = ReactTreeProvider([
        [UserProvider, { /* user-specific props */ }],
        [ThemeProvider, { /* theme-specific props */ }]
    ]);

    return (
        <Providers>
            <Component {...pageProps} />
        </Providers>
    );
}
```

In this example, ReactTreeProvider is used to create a Providers component, which wraps UserProvider and ThemeProvider around the main app component. You can pass any context providers you need, along with their props.

---
_Source: https://npm.io/package/react-tree-provider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
