You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.MD
+23-2Lines changed: 23 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -101,13 +101,13 @@ But how is this code working / running on the server? request$ is not an actual
101
101
We use a babel plugin built on top of vite that is meant to wrap functions that passed to query$ with server, so for instance:
102
102
103
103
```ts
104
-
query(myFn)
104
+
query$(myFn)
105
105
```
106
106
107
107
becomes
108
108
109
109
```ts
110
-
query(server$(myFn))
110
+
query$(server$(myFn))
111
111
```
112
112
113
113
This piece of code make the function run on the server, but how do we access the request?
@@ -129,3 +129,24 @@ query$(({ request$ }) => {
129
129
const headers =server$.request.headers
130
130
})
131
131
```
132
+
133
+
How do i run it on the client side?
134
+
135
+
query$ returns: `(...) => createQuery(...)`
136
+
So what it does is, it is taking the function that is running on the server (wrapped with server$) and basically try to query it using `createQuery` from solid query.
137
+
138
+
So:
139
+
140
+
```ts
141
+
const myQuery =query$(myFn)
142
+
```
143
+
144
+
Can be used client side (still will run on the server):
0 commit comments