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

Is it correct to use JSX as building blocks without adding client directives? #13245

Closed
1 task
kuworking opened this issue Feb 13, 2025 · 2 comments
Closed
1 task
Labels
needs triage Issue needs to be triaged

Comments

@kuworking
Copy link

Astro Info

Astro                    v5.3.0
Node                     v18.20.3
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/solid-js

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

As far as I can see, I can add JSX components through e.g. SolidJS, and if I don't add a client directive, I would say there's no javascript loaded with the component.

If this is true, is it a legit way to use JSX components in addition to the .astro components for a static, zero-js website?

---
import { Example } from '../components/Example.jsx'

---

<html lang="en">
	<head>
		<meta charset="utf-8" />
		<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
		<meta name="viewport" content="width=device-width" />
		<meta name="generator" content={Astro.generator} />
		<title>Astro</title>
	</head>
	<body>
		<h1>Astro</h1>
		<Example />
	</body>
</html>
export const Example = () => <div>how are you</div>;
// @ts-check
import { defineConfig } from 'astro/config';
import solid from '@astrojs/solid-js';

// https://astro.build/config
export default defineConfig({
  // ...
  integrations: [solid()],
});

What's the expected result?

If I am wrong and there's javascript packed within this approach, then nothing.
If this is working as a zero-js way to use JSX components, it could be not intended and deprecated in the future, or not.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-lzadmmzz?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 13, 2025
@florian-lefebvre
Copy link
Member

Yes it is absolutely fine! FYI issues are for bug reports, Discord is more suited for this kind of question

@florian-lefebvre florian-lefebvre closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2025
@kuworking
Copy link
Author

Thanks florian, I knew, but my concern is that this is not in the documentation, and if it is not there, it means it may not be a feature (and then a bug).

So you confirm that I can use this confidently that there will be zero javascript shipped in this way. Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants