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 - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

3

package.json
{
"name": "react-adopt",
"version": "0.2.5",
"version": "0.2.6",
"main": "dist/index.js",
"umd:main": "dist/index.umd.js",
"module": "dist/index.m.js",
"types": "dist/index.d.ts",
"source": "src/index.tsx",

@@ -8,0 +9,0 @@ "license": "MIT",

@@ -47,3 +47,3 @@ :sunglasses: _**React Adopt -**_ Compose render props components like a pro

Now you can use adopt to compose your components. See above an example using the awesome [react-powerplug](https://github.com/renatorib/react-powerplug):
Now you can use adopt to compose your components. See bellow an example using the awesome [react-powerplug](https://github.com/renatorib/react-powerplug):

@@ -77,3 +77,3 @@ ![Good](https://i.imgur.com/RXVlFwy.png)

Some components don't use the `children` property as render props. For cases like that, you can pass a function as mapper value that will return your component. This function will receive as props the `render` method, the props passed on `Composed` component and the previous values from each mapper. See an example:
Some components don't use the prop called `children` to make work render props. For cases like that, when you define your mapper you can pass a simple function as mapper value that will return your component, instead of a jsx element. This function will receive a prop `render` that will be responsible to make render, the props passed on `Composed` component and the previous values from each mapper. See an example:

@@ -115,2 +115,24 @@ ```js

And get previous mapper results as prop for compose:
```js
import { adopt } from 'react-adopt'
import { User, Cart, ShippingRate } from 'my-containers'
const Composed = adopt({
cart: <Cart />,
user: <User />,
shippingRates: ({ user, cart, render }) => (
   <ShippingRate zipcode={user.zipcode} items={cart.items}>
{render}
</ShippingRate>
)
})
<Composed>
{({ cart, user, shippingRates }) => /* ... */ }
</Composed>
```
### Leading with multiples params

@@ -117,0 +139,0 @@

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