react-component-from-prop
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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 .

yarn add 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

Package Sidebar

Install

npm i react-component-from-prop

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.1 kB

Total Files

4

Last publish

Collaborators

  • sugarshin