UNPKG

@saneksa/react-context-composer

Version:

[![NPM](https://img.shields.io/npm/v/@saneksa/react-context-composer?style=plastic&color=red)](https://npmjs.com/package/@saneksa/react-context-composer/) [![GitHub license](https://img.shields.io/npm/l/@saneksa/react-context-composer?style=plastic)](http

11 lines (8 loc) 383 B
import { jsx, Fragment } from 'react/jsx-runtime'; function composeContexts(wrappers) { return function (children) { return (jsx(Fragment, { children: wrappers.reduceRight(function (acc, _a) { var Context = _a[0], value = _a[1]; return (jsx(Context.Provider, { value: value, children: acc })); }, children) })); }; } export { composeContexts };