We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5094134 commit b763734Copy full SHA for b763734
src/routes/reference/component-apis/lazy.mdx
@@ -73,15 +73,18 @@ import type { Component } from "solid-js"
73
74
const Nested = lazy(() => import("./Nested"))
75
76
-const ComponentWithPreload: Component = () => {
77
- async function handlePreload() {
78
- await Nested.preload()
79
- }
+const ComponentWithPreload = () => {
+ const [showNested, setShowNested] = createSignal(false)
80
81
return (
82
<div>
83
- <button onClick={handlePreload}>Preload Nested Component</button>
84
- <Nested />
+ <button
+ onMouseEnter={() => Nested.preload()}
+ onClick={() => setShowNested(true)}
+ >Preload Nested Component</button>
85
+ <Show when={showNested()}>
86
+ <Nested />
87
+ </Show>
88
</div>
89
)
90
}
0 commit comments