Skip to content

Releases: pedronauck/react-adopt

Initial release

30 Mar 03:30
Compare
Choose a tag to compare

Usage

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