2018-07-11 10:27:30 +00:00
|
|
|
# Frontend basics
|
|
|
|
|
|
2018-12-04 08:51:17 +00:00
|
|
|
Reitit frontend integration is built from multiple layers:
|
|
|
|
|
|
2019-02-08 08:23:31 +00:00
|
|
|
- Core functions with some additional browser oriented features
|
|
|
|
|
- [Browser integration](./browser.md) for attaching Reitit to hash-change or HTML
|
2018-12-04 08:51:17 +00:00
|
|
|
history events
|
|
|
|
|
- Stateful wrapper for easy use of history integration
|
|
|
|
|
- Optional [controller extension](./controllers.md)
|
|
|
|
|
|
2025-01-28 13:46:37 +00:00
|
|
|
You likely won't use `reitit.frontend` directly in your apps and instead you
|
|
|
|
|
will use the API documented in the browser integration docs, which wraps these
|
|
|
|
|
lower level functions.
|
|
|
|
|
|
2018-12-04 08:51:17 +00:00
|
|
|
## Core functions
|
2018-08-22 18:58:20 +00:00
|
|
|
|
2020-09-04 18:49:56 +00:00
|
|
|
`reitit.frontend` provides some useful functions wrapping core functions:
|
2018-08-23 07:41:13 +00:00
|
|
|
|
2018-12-04 08:51:17 +00:00
|
|
|
`match-by-path` version which parses a URI using JavaScript, including
|
|
|
|
|
query-string, and also [coerces the parameters](../coercion/coercion.md).
|
|
|
|
|
Coerced parameters are stored in match `:parameters` property. If coercion
|
|
|
|
|
is not enabled, the original parameters are stored in the same property,
|
|
|
|
|
to allow the same code to read parameters regardless if coercion is
|
|
|
|
|
enabled.
|
|
|
|
|
|
|
|
|
|
`router` which compiles coercers by default.
|
|
|
|
|
|
|
|
|
|
`match-by-name` and `match-by-name!` with optional `path-paramers` and
|
|
|
|
|
logging errors to `console.warn` instead of throwing errors to prevent
|
2025-01-28 13:46:37 +00:00
|
|
|
React breaking due to errors. These can also [encode query-parameters](./coercion.md)
|
|
|
|
|
using schema from match data.
|
2018-12-04 08:51:17 +00:00
|
|
|
|
|
|
|
|
## Next
|
|
|
|
|
|
|
|
|
|
[Browser integration](./browser.md)
|