Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't map props to HTML attributes by default #48

Open
ngryman opened this issue Feb 20, 2023 · 1 comment
Open

Don't map props to HTML attributes by default #48

ngryman opened this issue Feb 20, 2023 · 1 comment

Comments

@ngryman
Copy link

ngryman commented Feb 20, 2023

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.

@tpudel
Copy link

tpudel commented Jun 11, 2023

Isn't this solved by using the shouldForwardProp helper?

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

@ngryman ngryman changed the title Component props are added to the HTML element as attributes Don't map props to HTML attributes by default Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants