Creates a component that accepts a component as a prop and renders it with the remaining props.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
.gitignore
.huskyrc.json
.lintstagedrc
.node-version
.prettierrc
README.md
jest.config.json
package.json
renovate.json
setup-test.ts
test.tsx
tsconfig.json
tsconfig.test.json
tslint.json
yarn.lock

README.md

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