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

feat(jsx): export FC #1420

Merged
merged 2 commits into from
Sep 9, 2023
Merged

feat(jsx): export FC #1420

merged 2 commits into from
Sep 9, 2023

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Sep 7, 2023

This PR makes JSX supports exporting FC. You can use it for specifying types to the function component.

import { FC } from 'hono/jsx'

const Layout: FC<{ title: string }> = (props) => {
  return (
    <html>
      <head>
        <title>{props.title}</title>
      </head>
      <body>{props.children}</body>
    </html>
  )
}

const Top = (
  <Layout title='Home page'>
    <h1>Hono</h1>
    <p>Hono is great</p>
  </Layout>
)

Fix #1419

Author should do the followings, if applicable

  • Add tests
  • Run tests
  • yarn denoify to generate files for Deno

Copy link

@huv1k huv1k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🙌

@huv1k
Copy link

huv1k commented Sep 8, 2023

Can we maybe export Child from hono/jsx too? 🤔

@msonnemans
Copy link

msonnemans commented Sep 8, 2023

Great improvement! 👍

@yusukebe yusukebe changed the base branch from main to next September 9, 2023 08:11
@yusukebe yusukebe merged commit 27d2620 into next Sep 9, 2023
10 checks passed
@yusukebe yusukebe deleted the feat/jsx-export-fc branch September 9, 2023 08:12
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.

JSX usage example not working
3 participants