get-react-props
v1.0.0
Published
TS utility types to extract component props
Downloads
15
Readme
Get-react-props
TS utility types to extract component props
Install
npm install get-react-props
Usage
import { GetProp, GetProps } from 'get-react-props';
const Foo: FC<{ foo: 'bar' }> = ({ foo }) => {
return <div>{foo}</div>;
};
const Bar: FC<{ fooProps: GetProps<typeof Foo> }> = ({ fooProps }) => {
return (
<div>
<Bar {...fooProps} />
</div>
);
};
const Baz: FC<{ foo: GetProp<typeof Foo, 'foo'> }> = ({ foo }) => {
return (
<div>
<Foo foo={foo} />
</div>
);
};