To add a custom class, you’ll need to use an override that modifies the element’s className property. Overrides let you extend or adjust an element’s behavior without changing its core structure.
import type { ComponentType } from "react";
export function withClass(Component): ComponentType {
return (props) => {
props.className += " test"; // Remember to add a space
return <Component {...props} />;
};
}