Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.9K
decreased by-47.31%
Maintainers
1
Weekly downloads
 
Created
Source

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

GitHub release Build Status Coveralls 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

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

Install as project dependency:

$ yarn add react-adopt

Then you can use the method to compose your components

import React from 'react'
import { render } from 'react-dom'
import { adopt } from 'react-adopt'

import { Filter } from './my-awesome-filter-component'

const Composed = adopt({
  kids: <Filter list={people} by={p => p.age < 18} />,
  adults: <Filter list={people} by={p => p.age >= 18} />
})

const App = () => (
  <Composed>
    {({ kids, adults }) => (
      <div>
        <ul>{kids.map(p => <li>{p.name}</li>)}</ul>
        <ul>{adults.map(p => <li>{p.name}</li>)}</ul>
      </div>
    )}
  </Composed>
)

🕺   Contribute

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

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc