39

GitHub - pedronauck/react-adopt: Compose render props components like a pro

 6 years ago
source link: https://github.com/pedronauck/react-adopt
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

?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 called a *"render props callback hell", like that:

Bad

?   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

Now you can use adopt to compose your components. See above an example using the awesome react-powerplug:

Good

?   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 ?

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK