@react5/dom-jsx 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,15 +24,19 @@ The runtime also works with Vite. Vite discovers the package's ESM `jsx-runtime`
|
|
|
24
24
|
Function components may return DOM nodes with an attached API:
|
|
25
25
|
|
|
26
26
|
```tsx
|
|
27
|
-
type ModalContext = { open
|
|
27
|
+
type ModalContext = { open(): void; close(): void }
|
|
28
28
|
|
|
29
29
|
function Modal() {
|
|
30
|
-
const element = <dialog />
|
|
31
|
-
|
|
30
|
+
const element = <dialog /> as HTMLDialogElement
|
|
31
|
+
|
|
32
|
+
return Object.assign(element, {
|
|
33
|
+
open: () => element.showModal(),
|
|
34
|
+
close: () => element.close()
|
|
35
|
+
}) satisfies HTMLDialogElement & ModalContext
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
const modal = <Modal />
|
|
35
|
-
modal.
|
|
39
|
+
modal.open()
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
TypeScript represents all JSX expressions with one `JSX.Element` type, so it
|