This repository has been archived by the owner on Sep 10, 2022. It is now read-only.
v0.9.0
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" />