Skip to content

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

Open

Description

@ngryman

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.

Activity

  1. tpudel commented on Jun 11, 2023

    @tpudel

    Isn't this solved by using the shouldForwardProp helper?

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

  2. changed the title [-]Component props are added to the HTML element as attributes[/-] [+]Don't map props to HTML attributes by default[/+] on Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions