Details
-
Improvement
-
Resolution: Outdated
-
Neutral
-
None
-
None
-
None
-
None
Description
I created a Higher order component (HOC) to use with React. It is a reusable function that replaces the generated wrapper/builder from the HA generator. I don't see where the ha-cli project is hosted, so can't create a PR for it, but here is my code:
export function withMgnlProps<P extends object>( Component: React.ComponentType<P> ): React.FC<P> { const WithMgnlProps = (props: PropsWithChildren<P>) => { const transformed = transformNode({ ...props }); return <Component {...transformed} />; }; const displayName = Component.displayName || Component.name || "Component"; WithMgnlProps.displayName = `WithMgnlProps(${displayName})`; return WithMgnlProps; }
Checklists
Acceptance criteria