I am getting the following error because I'm probably not spreading the maxWidth property correctly:
Warning: React does not recognize the maxWidth prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase maxwidth instead. If you accidentally passed it from a parent component, remove it from the DOM element.
I believe the error stems from the way I'm spreading the properties to the component:
export const Card = forwardRef<HTMLDivElement, CardProps>(
({ outline, elevation, width = 'inherit', maxWidth='650px', isModal, ...props }, ref) => {
const CardWrapper = isModal ? DialogWrapper : Wrapper
return (
<CardWrapper
ref={ref}
{...{ outline, elevation, width, maxWidth, ...props }}
>
<CardContent {...{ elevation, isModal, ...props }} />
</CardWrapper>
)
}
)
As you can see I'm spreading maxWidth='650px' when it should be max-width='650'. The problem is that I'm not sure how to spread it using an alias or something
maxWidth is actually not a prop on a DOM element. maxWidth is a style and should be used like this <div style={{maxWidth:'650px'}}> or else your CardWrapper accepts maxWidth as prop