Skip to content

Commit e4fd984

Browse files
Updated docs with info on 404 (#216)
1 parent 2a7b70c commit e4fd984

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/router/configuration.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,31 @@ export const App = () => (
8888
Here, we are assuming that your server has returned HTML with a script tag that has declared the `__SSR_STATE__` object. For more info on this please checkout [this section](#how-to-use-the-router-on-the-server) on using the router on the server.
8989

9090
**NOTE:** When the `resourceData` prop is set, the router will **not** request resources on mount.
91+
92+
## Adding a 404 Route
93+
94+
The router will render nothing if no routes match the current location. This is useful if you want to render a 404 page. To do this, simply add a route with an empty string `""` to your routes array.
95+
96+
**NOTE:** You can not include the path property for the 404 route when using JS. However when using TS you must include the path property and set it to an empty string.
97+
98+
```js
99+
export const routes = [
100+
{
101+
path: '/home',
102+
name: 'HOME',
103+
component: Home,
104+
resources: [homeResource],
105+
},
106+
{
107+
path: '/about',
108+
name: 'ABOUT',
109+
component: About,
110+
resources: [aboutResource],
111+
},
112+
{
113+
path: '',
114+
name: '404',
115+
component: NotFound,
116+
},
117+
];
118+
```

0 commit comments

Comments
 (0)