Releases: pedronauck/react-adopt
Releases · pedronauck/react-adopt
v0.6.0
Changelog
- Add support to pass a component as mapper value
- Hoisting non-react statics methods from mapper value to Composed component (thanks @russelh15)
import { React } from 'react'
import { adopt } from 'react-adopt'
import { Value } from 'react-powerplug'
const Greeter = ({ render, name }) => render(`Hi ${name.value}`)
Greeter.sayHi = (name) => `Hi ${name}`
const Composed = adopt({
name: <Value name="John" />
greet: Greet
})
console.log(Composed.sayHi('John')) // Hi John
const App = () => (
<Composed>
{({ greet, name }) => /* ... */ }
</Composed>
)
v0.5.1
Changelog
- Add
render
prop to composed component (thanks @ctrlplusb for the idea) - Improve some types
import { adopt } from 'react-adopt'
import { Value } from 'react-powerplug'
const Composed = adopt({
foo: <Value initial="foo" />
})
const App = () => (
<Composed render={({ foo }) => /* ... */ } />
)
v0.4.1
Changelog
- Feat: add map props feature (1ae14f8)
import { adopt } from 'react-adopt'
import { Value } from 'react-powerplug'
const Composed = adopt({
greet: <Value initial="Hi" />,
name: <Value initial="John" />,
},
// mapping props from results
({ greet, name }) => ({
message: `${greet.value} ${name.value}`,
}))
const App = () => (
<Composed>
{({ message }) => /* ... */}
</Composed>
)
v0.3.3
v0.3.1
Changelog
- Add support for inline composition using
<Adopt>
component (ac09efe)
Inline composition
If you dont care about typings and need something more easy and quick, you can choose to use a inline composition by importing <Adopt>
component and passing your mapper as prop:
import React from 'react'
import { Adopt } from 'react-adopt'
import { Value } from 'react-powerplug'
const mapper = {
greet: <Value initial="Hi" />,
name: <Value initial="John" />
}
<Adopt mapper={mapper}>
{({ greet, name }) => /* ... */}
</Adopt>
v0.2.9
Changelog
- Improve readme with some exampels
- Fix: add
types
andfiles
fields onpackage.json
- Fix: optional types for render props
- Fix: typescript definitions
v0.2.3
Changelog
- Remove required node engine from package.json
- Add a lot of improvements on readme
v0.2.2
Changelog
- Improve typescript support
- Improve readme with some examples of usage
v0.2.1
Changelog
- Add support to pass a function as mapper value
- Add support to retrieving props from composed
- Add support for component with custom renderprops
More info about these features on readme
Thanks for @lucasconstantino ✌️
v0.1.2
Changelog
- Some documentation improvements