Skip to content

Commit 4cc5cae

Browse files
committed
update examples
1 parent 32cb4a3 commit 4cc5cae

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

examples/cra/src/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React from "react"
2-
import ReactDOM from "react-dom"
2+
import { createRoot } from "react-dom/client"
33
import "./index.css"
44
import App from "./App"
55
import reportWebVitals from "./reportWebVitals"
66

7-
ReactDOM.render(
7+
const container = document.getElementById("root")
8+
const root = createRoot(container!) // createRoot(container!) if you use TypeScript
9+
root.render(
810
<React.StrictMode>
911
<App />
1012
</React.StrictMode>,
11-
document.getElementById("root"),
1213
)
1314

1415
// If you want to start measuring performance in your app, pass a function

examples/vite-app/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const Lol = () => {
88
// console.log(app)
99
// const a = app.get("a")
1010
// console.log(a)
11-
// const [b, bErr] = useContainer().b
12-
// console.log("v", b, bErr)
11+
const [b, bErr] = useContainer().b
12+
console.log("render", b, bErr)
1313
return <p>123</p>
1414
}
1515

examples/vite-app/src/_bl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const app = makeRoot()
1313
a: () => new A(),
1414
}))
1515
.add((ctx) => ({
16-
b: () => new B(ctx.a),
16+
b: async () => new B(ctx.a),
1717
}))
1818
.add((ctx) => ({
1919
c: () => new C(ctx.a, ctx.b),

0 commit comments

Comments
 (0)