@@ -257,20 +257,13 @@ The syntax tree is [hast][].
257257
258258## JSX
259259
260- This package can be used with JSX.
261- You should use the automatic JSX runtime set to ` hastscript ` (also available as
262- the more explicit name ` hastscript /html ` ) or ` hastscript /svg ` .
260+ This package can be used with JSX by setting your
261+ [ ` jsxImportSource ` ][jsx-import-source] to ` hastscript `
263262
264263> 👉 **Note**: while ` h ` supports dots ( ` .` ) for classes or number signs ( ` #` )
265264> for IDs in ` selector ` , those are not supported in JSX.
266265
267- > 🪦 **Legacy**: you can also use the classic JSX runtime, but this is not
268- > recommended.
269- > To do so, import ` h ` (or ` s ` ) yourself and define it as the pragma (plus
270- > set the fragment to ` null ` ).
271-
272- The Use example above can then be written like so, using inline pragmas, so
273- that SVG can be used too:
266+ For example, to write the hastscript example provided earlier u
274267
275268` example -html .jsx ` :
276269
@@ -287,6 +280,8 @@ console.log(
287280)
288281` ` `
289282
283+ SVG can be used too by setting ` jxsImportSource ` to ` hastscript /svg ` :
284+
290285` example -svg .jsx ` :
291286
292287` ` ` jsx
@@ -299,6 +294,15 @@ console.log(
299294)
300295` ` `
301296
297+ > 🪦 **Legacy**: you can also use the classic JSX runtime by importing either
298+ > ` h ` (or ` s ` ) manually from ` hastscript /jsx -factory ` and setting it as the
299+ > ` jsxFactory ` in your transpiler, but it is not recommended. For example:
300+
301+ ` ` ` jsx
302+ /** @jsxFactory h */
303+ import { h } from " hastscript/jsx-factory" ;
304+ ```
305+
302306## Types
303307
304308This package is fully typed with [ TypeScript] [ ] .
@@ -466,3 +470,5 @@ abide by its terms.
466470[ properties ] : #properties-1
467471
468472[ result ] : #result
473+
474+ [ jsx-import-source ] : https://react.dev/jsx-transform
0 commit comments