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

fix: no need for prop function #4088

Merged
merged 2 commits into from
May 7, 2023
Merged

fix: no need for prop function #4088

merged 2 commits into from
May 7, 2023

Conversation

manucorporat
Copy link
Contributor

@manucorporat manucorporat commented May 6, 2023

This PR allows to not need PropFunction to create custom events:

interface CmpProps {
  onClick$?: () => void;
}

export const Cmp = component$<CmpProps>((props) => {
  return (
    <div>
      <h1>CHILD</h1>
    </div>
  )
});

@stackblitz
Copy link

stackblitz bot commented May 6, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@cloudflare-pages
Copy link

cloudflare-pages bot commented May 6, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8cdcea3
Status: ✅  Deploy successful!
Preview URL: https://737eb873.qwik-docs.pages.dev
Branch Preview URL: https://fix-no-prop-function.qwik-docs.pages.dev

View logs

@manucorporat manucorporat marked this pull request as draft May 6, 2023 19:23
@manucorporat manucorporat marked this pull request as ready for review May 6, 2023 21:06
@shairez
Copy link
Collaborator

shairez commented May 6, 2023

Wow that's amazing! 😊

@manucorporat manucorporat merged commit 39541ab into main May 7, 2023
22 checks passed
@manucorporat manucorporat deleted the fix-no-prop-function branch May 7, 2023 09:21
@motss
Copy link

motss commented May 12, 2023

Does it make sense to pass renderProps to another component?

interface AProps {
  onClick$?(): void;
  render$?(): JSX.Element;
}

export const A = component$<AProps>((props) => {
  return (
    <div>
      <h1>CHILD</h1>
      <B onClick$={props.onClick$} render$={props.render$} />
    </div>
  )
});

Confirmed to be an issue for renderProps and raised #4200 for this.

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

Successfully merging this pull request may close these issues.

None yet

3 participants