Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

v0.9.0

Compare
Choose a tag to compare
@acdlite acdlite released this 05 Nov 04:40
· 494 commits to master since this release

New util:

componentFromProp()

componentFromProp(propName: string): ReactElementType

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

Example:

const Button = defaultProps(
  { component: 'button' },
  componentFromProp('component')
);

<Button foo="bar" /> // renders <button foo="bar" />
<Button component="a" foo="bar" />  // renders <a foo="bar" />
<Button component={Link} foo="bar" />  // renders <Link foo="bar" />