Skip to content

Commit e8ea96f

Browse files
committed
implement prefetching in example
1 parent 98f68ac commit e8ea96f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/vite/src/App.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ function App() {
6565
: posts.data?.map((post) => (
6666
<div key={post.id}>
6767
<a>
68-
<h2 onClick={() => setPostId(post.id)}>{post.title}</h2>
68+
<h2
69+
onClick={() => setPostId(post.id)}
70+
onMouseOver={() => {
71+
postQuery.client.ensureData({ params: { id: post.id } });
72+
commentsQuery.client.ensureData({ search: { postId: post.id } });
73+
}}
74+
>
75+
{post.title}
76+
</h2>
6977
</a>
7078

7179
<button

0 commit comments

Comments
 (0)