@vimpak/jsx 0.2.0 → 0.3.0

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.
Files changed (2) hide show
  1. package/README.md +19 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -93,6 +93,21 @@ function App() {
93
93
  const html = await render(<App />, ctx);
94
94
  ```
95
95
 
96
+ ### Async Components
97
+
98
+ Components can be asynchronous:
99
+
100
+ ```tsx
101
+ async function User({ id }: { id: string }) {
102
+ const user = await fetchUser(id);
103
+ return <div>{user.name}</div>;
104
+ }
105
+
106
+ const html = await render(<User id="1" />);
107
+ ```
108
+
109
+ The `render` function awaits all async components automatically.
110
+
96
111
  ## API
97
112
 
98
113
  ### `render(element, context?)`
@@ -103,3 +118,7 @@ Renders a JSX element to an HTML string.
103
118
  - **context** (optional): A `Context` value for passing values to all components
104
119
 
105
120
  Returns `Promise<string>`.
121
+
122
+ ## Thanks
123
+
124
+ - https://github.com/kitajs/html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "name": "@vimpak/jsx",
5
5
  "collaborators": [
6
6
  "Sudesh Yadav <sudeshyadav955@gmail.com>"