Skip to content

Commit

Permalink
chore: improve readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Mar 30, 2018
1 parent ba21c13 commit 456ede1
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,22 @@ Install as project dependency:
$ yarn add react-adopt
```

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

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

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

const Composed = adopt({
kids: <Filter list={people} by={p => p.age < 18} />,
adults: <Filter list={people} by={p => p.age >= 18} />
greet: <Value initial="Hello" />,
name: <Value initial="John" />,
})

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>
{({ greet, name }) => (
<div>{greet.value} {name.value}</div>
)}
</Composed>
)
Expand Down

0 comments on commit 456ede1

Please sign in to comment.