@nixjs23n6/react-nest-providers
Version:
A lightweight, type-safe utility for composing multiple React providers into a single, nested tree. Simplify your provider setup with a clean, declarative API that supports optional props and seamless integration with TypeScript. Perfect for managing cont
1 lines • 238 B
JavaScript
import{createElement as e,Fragment as r}from"react";export const buildProvidersTree=t=>({children:l})=>{let n="string"==typeof l||"number"==typeof l?e(r,null,l):l;return t.reduceRight((r,t)=>{let[l,n]=t;return n?e(l,n,r):e(l,null,r)},n)};