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

look into function syntax for onClick #6

Open
reggi opened this issue Nov 15, 2022 · 1 comment
Open

look into function syntax for onClick #6

reggi opened this issue Nov 15, 2022 · 1 comment

Comments

@reggi
Copy link
Owner

reggi commented Nov 15, 2022

currently calling "new" on an export class is tricky implementation is rudimentary now, but could offer more flexability?

could convert this anon onClick prop to string?

import { Fragment } from "preact";
import { HTMX, HTMXComponents } from "../mod.tsx";

const { component, serve, routes, clientImport } = new HTMXComponents('@reggi/client-code')

const multi = await clientImport('./client_code/multi.ts')

export const OnClick = component('/client-code-on-click', () => {
  return (
    <Fragment>
      <HTMX.div onClick={() => {
        const x = new multi.Dog()
        console.log(x.name)
      }}>Do something else</HTMX.div>
    </Fragment>
  )
})

if (!Deno.env.get('NO_SERVE')) {
  await serve()
}

export { routes }
@reggi
Copy link
Owner Author

reggi commented Nov 15, 2022

maybe all people need is the functions they export, if you need anything more do it in client files this is silly.

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

1 participant