Skip to content

Commit 39b1d16

Browse files
committed
docs: Update ReadMe
1 parent 511928a commit 39b1d16

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Isomorphic async tools for Preact.
2626
- [hydrate()](#hydrate)
2727
- [prerender()](#prerender)
2828
- [locationStub()](#locationstub)
29+
- [Navigation API Entry Docs](#navigation-api-entry-docs)
30+
- [Differences in usage](#differences-in-usage)
2931

3032
---
3133

@@ -436,6 +438,18 @@ locationStub('/foo/bar?baz=qux#quux');
436438
console.log(location.pathname); // "/foo/bar"
437439
```
438440

441+
## Navigation API Entry Docs
442+
443+
The Navigation API is a new web standard that provides an updated method of handling "navigation" in web applications, supporting SPA-style routing as a first-class citizen. The older History API can be wrangled to support this and has been the standard for many years, but the Navigation API provides a much more robust set of tools that are really, really attractive for routers like `preact-iso` to take advantage of.
444+
445+
Whilst the API [sees fairly wide support](https://caniuse.com/wf-navigation), it is still newly available and thus may not be viable for some targets. As such, we've provided a new entry point that will allow you to take advantage of this API if you wish, but the default remains targetting the History API. The Navigation API entry point is available at `preact-iso/router/navigation-api`.
446+
447+
### Differences in usage
448+
449+
The differences lie entirely within the [`useLocation()`](#uselocation) hook: instead of returning a `route()` function, you use the global `navigation` object to perform all navigations.
450+
451+
The [`navigation` object](https://developer.mozilla.org/en-US/docs/Web/API/Navigation) contains many of the useful utilities that go along with a router, like `.forward()`, `.back()`, `.canGoForward()`, `.canGoBack()`, `.entries()`, etc. It actually offers far more utilities than the base router did, and does so with less library code overall, so if you have access to it, it's a really nice upgrade.
452+
439453
## License
440454

441455
[MIT](./LICENSE)

0 commit comments

Comments
 (0)