This exercise will test your understanding of the core concepts in the class.
You will build a Border
polymorphic React component.
Here is the basic usage of the component:
export const UserComponent = () => {
return (
<Border as="blockquote" color="blue" width={4} variant="solid">
You only truly learn by practicing
</Border>
);
};
The Border component renders a styled border around whatever the children node is.
- The component must accept a polymorphic
as
prop - The component must render the passed in
as
element type - The component should support its own props e.g.,
color
,width
andvariant
. Wherecolor
is any validcolor
string, andwidth
a number that defines the width of the border andvariant
the style of the border. See the valid CSS border styles on W3schools - Using typescript, the component should display a type error during development if an invalid element type is passed
- Using typescript, the component should display a type error if wrong attributes are passed for valid element types
- Using typescript, the component should display a type error if wrong refs are passed to the component