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
| params | object | The route parameters (same value as calling [`useParams()`](/solid-router/reference/primitives/use-params) inside the route component) |
29
-
| location |`{ pathname, search, hash, query, state, key}`| An object that used to get more information about the path (corresponds to [`useLocation()`](/solid-router/reference/primitives/use-location)) |
30
-
| intent |`"initial", "navigate", "native", "preload"`| Indicates why this function is being called. <ul><li>"initial" - the route is being initially shown (ie page load)</li><li>"native" - navigate originated from the browser (eg back/forward)</li><li>"navigate" - navigate originated from the router (eg call to navigate or anchor clicked)</li><li>"preload" - not navigating, just preloading (eg link hover)</li></ul> |
31
-
32
26
A common pattern is to export the load function and data wrappers that correspond to a route in a dedicated `route.data.js` file.
33
27
This imports the data functions without loading anything else.
34
28
@@ -51,7 +45,7 @@ The return value of the `load` function is passed to the page component as a `da
51
45
```js
52
46
//pages/users/[id].jsx
53
47
exportdefaultfunctionUser(props) {
54
-
return<p>{props.data().name}</p>
48
+
return<p>{props.data().name}</p>;
55
49
}
56
50
```
57
51
@@ -78,7 +72,9 @@ const User = lazy(() => import("./pages/users/[id].js"));
78
72
79
73
import { cache } from"@solidjs/router";
80
74
81
-
exportconstgetUser=cache((id) => { /* do loading */ }, "users");
| params | object | The route parameters (same value as calling [`useParams()`](/solid-router/reference/primitives/use-params) inside the route component) |
98
+
| location |`{ pathname, search, hash, query, state, key}`| An object that used to get more information about the path (corresponds to [`useLocation()`](/solid-router/reference/primitives/use-location)) |
99
+
| intent |`"initial", "navigate", "native", "preload"`| Indicates why this function is being called. <ul><li>"initial" - the route is being initially shown (ie page load)</li><li>"native" - navigate originated from the browser (eg back/forward)</li><li>"navigate" - navigate originated from the router (eg call to navigate or anchor clicked)</li><li>"preload" - not navigating, just preloading (eg link hover)</li></ul> |
0 commit comments