Closed Hardtack closed 7 years ago
We have cool API named Wrapper and PropWrapper. But, type inferencing of these components is too complex.
Wrapper
PropWrapper
So I'm considering to change API with following.
For default HTML element
<Button>Text</Button>
And for custom HTML Element
<Button.Wrap> <a href="link">Text</a> </Button.Wrap>
Implementation may be like
class Wrap extends React.Component<WrapperProps, State> { //... } export default class Button extends React.Component<WrapperProps & Props, {}> { public static Wrap = Wrap; public render() { const { buttonProp1, buttonProp2, ...props, } return ( <Wrap buttonProp1={buttonProp1} buttonProp2={buttonProp2}> <button {...props} /> </Wrap> ); } }
This is also cool
We have cool API named
Wrapper
andPropWrapper
. But, type inferencing of these components is too complex.So I'm considering to change API with following.
For default HTML element
And for custom HTML Element
Implementation may be like
This is also cool