/react-component-from-prop

Creates a component that accepts a component as a prop and renders it with the remaining props.

Primary LanguageTypeScript

react-component-from-prop

CircleCI Codecov npm version License

Creates a component that accepts a component as a prop and renders it with the remaining props.

This project is a just fork from recompose .

npm install react-component-from-prop

Usage

// e. g.,

import componentFromProp from 'react-component-from-prop'
import { Link } from 'react-router-dom'

const Anchor = componentFromProp('component')
Anchor.defaultProps = { component: 'a' }
<Anchor component={Link} to="/foo">Click</Anchor> // <a href="/foo">Click</a>

License

MIT

© sugarshin