react-nest-components

0.1.1 • Public • Published

react-nest-components

Installation

$ yarn add react-nest-components

or

$ npm install --save react-nest-components

Usage

import React, { createElement } from 'react'
import nest, { render } from 'react-nest-components';
import i18n from './i18n';
 
 
const AppProviders = nest(
  AnalyticsProvider,
  () => render(LanguageProvider, { i18n }),
  ThemeProvider,
  CustomProvider
);
 
// Note: the above will create the following
// const AppProviders = ({children}) => (
//   <AnalyticsProvider>
//     <LanguageProvider i18n={i18n}>
//       <ThemeProvider>
//         <CustomProvider>
//           {children}
//         </CustomProvider>
//       </ThemeProvider>
//     </LanguageProvider>
//   </AnalyticsProvider>
// );
 
ReactDOM.render(
  <AppProvider>
    <App/>
  </AppProvider>, 
  document.getElementById('root)
);
 
 

Why do this? Why so extra?

TODO

  • Add documentation
  • Implement tests

Package Sidebar

Install

npm i react-nest-components

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

1.9 kB

Total Files

4

Last publish

Collaborators

  • darkfadr