Socket
Book a DemoInstallSign in
Socket

react-adopt

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-adopt

[Render Props](https://reactjs.org/docs/render-props.html) are the new hype of React's ecossystem, that's a fact. So, when you need to use more than one render props component together, this can be borring and generate something like a *"render hell"*.

0.1.2
Source
npmnpm
Version published
Weekly downloads
8.9K
49.31%
Maintainers
1
Weekly downloads
 
Created
Source

:sunglasses: React Adop - Compose render props components like a pro

GitHub release Build Status Codacy Badge

🧐   Why

Render Props are the new hype of React's ecossystem, that's a fact. So, when you need to use more than one render props component together, this can be borring and generate something like a "render hell".

💡   Solution

  • Small. 0.7kb minified!
  • Extremelly Simple. Just a method!

React Adopt it's just a simple method that you can compose your components and return all props in a function by mapping each child prop returned by your component.

💻   Usage (demo)

Install as project dependency:

$ yarn add react-adopt

Then you can use the method to compose your components. See above an example using the awesome library react-powerplug:

import React from 'react'
import { adopt } from 'react-adopt'
import { Value } from 'react-powerplug'

const Composed = adopt({
  greet: <Value initial="Hello" />,
  name: <Value initial="John" />,
})

const App = () => (
  <Composed>
    {({ greet, name }) => (
      <div>{greet.value} {name.value}</div>
    )}
  </Composed>
)

🕺   Contribute

  • Fork this repository to your own GitHub account and then clone it to your local device
  • Install dependencies using Yarn: yarn install
  • Make the necessary changes and ensure that the tests are passing using yarn test
  • Send a pull request 🙌

Keywords

react

FAQs

Package last updated on 30 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.