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

Qwik: Functions passed as props are not suffixed with $ #1645

Open
1 of 12 tasks
k-schneider opened this issue Nov 19, 2024 · 0 comments
Open
1 of 12 tasks

Qwik: Functions passed as props are not suffixed with $ #1645

k-schneider opened this issue Nov 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@k-schneider
Copy link

I am interested in helping provide a fix!

No

Which generators are impacted?

  • All
  • Angular
  • HTML
  • Preact
  • Qwik
  • React
  • React-Native
  • Solid
  • Stencil
  • Svelte
  • Vue
  • Web components

Reproduction case

https://mitosis.builder.io/playground/?code=KYDwDg9gTgLgBAE2AMwIYFcA29noHYDGMAlhHnALICeAwhALaR7B4wAUYUEYAzgJRwA3gCg4cKMBjoo5NqLFwAPACN0MGGThkamYgQDWAXkGduPAHTbdBgL5wA9AD55fANzCbQA%3D

Expected Behaviour

Function props are suffixed with $ so that you can pass functions directly:

export default component$(() => {
  return (
    <Button onClick$={() => console.log("Hello")} />
  );
});

Actual Behaviour

The functions are not suffixed, so you have to create QRL's manually to be able to pass them into the generated components.

export default component$(() => {
  const clickHandler = $(() => {
    console.log("Hello");
  });

  return (
    <Button onClick={clickHandler} />
  );
});

Additional Information

This format for Qwik event handlers is discussed further here:

https://qwik.dev/docs/components/events/

@k-schneider k-schneider added the bug Something isn't working label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant