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

Template seems not to support children props #30

Open
derolf opened this issue Dec 18, 2023 · 1 comment
Open

Template seems not to support children props #30

derolf opened this issue Dec 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@derolf
Copy link

derolf commented Dec 18, 2023

Here's a template for a Row:

export const Row = template(
  (props: { style?: JSX.StyleProperties; children?: JSX.Children }) => {
    props = {
      ...props,
      style: {
        display: "flex",
        flexDirection: "row",
        ...props.style,
      },
    };
    return <div {...props} />;
  },
);

Example usage:

<Row>test</Row>

Renders:

<div style="display: flex; flex-direction: row;"></div>

Expected:

<div style="display: flex; flex-direction: row;">test</div>
@fabiospampinato fabiospampinato changed the title template seems not to support children props Template seems not to support children props Dec 18, 2023
@fabiospampinato fabiospampinato added the bug Something isn't working label Dec 18, 2023
@fabiospampinato
Copy link
Member

The template helper is a bit of a gimmick right now, very limited usage. Eventually it will probably be replaced with just more optimized tagged template literals, and an opt-in way to convert JSX to that at build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants