solid-styled-components icon indicating copy to clipboard operation
solid-styled-components copied to clipboard

Don't map props to HTML attributes by default

Open ngryman opened this issue 2 years ago • 1 comments

Hi,

When using styled, the props passed to the component are added to the HTML element as attributes.

For instance, the following component:

type AppProps = {
  foo: boolean;
  bar: number;
};

const App: Component<AppProps> = styled.main``;

const root = document.getElementById('root');
render(() => <App foo={true} bar={42} />, root!);

Will result in the following DOM:

Here is the code of a simple repro case.

It might be related to #6.

ngryman avatar Feb 20 '23 20:02 ngryman

Isn't this solved by using the shouldForwardProp helper?

Docs: https://github.com/solidjs/solid-styled-components#shouldforwardprop

tpudel avatar Jun 11 '23 19:06 tpudel