Instead of writing:
export const MyComponent = (props: { className: string }) => {
return (
<div className={props.className}>
<div className="pt-10 pb-14 px-8" />
</div>
);
};
I could write:
export const MyComponent = classy.div(() => {
return <div className="pt-10 pb-14 px-8">;
});
Or:
const MyDiv = classy.div();
export const MyComponent = MyDiv.extend(() => {
return <div className="pt-10 pb-14 px-8">;
});
This would introduce two API changes:
- If the argument type is a function, classy creates a wrapped component.
- Classy components can be extended by calling an
extend method. If a classnames object is the argument, it is merged with the original classnames object. If a function is the argument, the original component is wrapped, as per 1.
Instead of writing:
I could write:
Or:
This would introduce two API changes:
extendmethod. If a classnames object is the argument, it is merged with the original classnames object. If a function is the argument, the original component is wrapped, as per 1.