react-props-x
v0.0.2
Published
Provide React util. FCX & PX
Downloads
3
Readme
react-props-x
import { FCX, PX } from "react-props-x";
/**
* Without this library
*/
const Link: React.FC<{ href: string }> = ({ href, children }) => (
<a href={href}>{children}</a>
);
/**
* Using FCX
*/
const Link1: FCX<"a"> = ({ children, ...props /** ←typed! */ }) => (
<a {...props}>{children}</a>
);
/**
* Using PX
*/
const Link2 = ({ children, ...props }: PX<typeof Link>) => (
<Link {...props}>{children}</Link>
);
// → Link2: FCX<typeof Link>