@atomico/router
powerful router for Webcomponents, React and Preact
@atomico/router aims to facilitate the creation of SPA-type applications through the following strategies:
slot: you can reference a slot within the Router Switch to show on a specific path.
elements: you will be able to mount CustomElements through Instantable elements.
asynchronous generators: through asynchronous generators you will be able to show multiple views according to the load state, for example transitions.
Syntax
Elements
RouterSwitch
Properties
Props | Description | Type | Event |
---|---|---|---|
case | slot to associate at the time of the match with path | String - read only | match |
Events
Event | JSX | |
---|---|---|
Match | onMatch | It is dispatched every time the router matches a new route. |
RouterCase
Component that declares the behavior of the route, with it you can:
Define a slot to show instantly when matching the browser path.
Define a load callback to execute when matching the browser route.
Properties
Props | Description | Type |
---|---|---|
load | asynchronous content loader | Function |
for | slot to associate at the time of the match with path | String |
path | expression for path | String |
memo | memorize the state resolved by load according to the concurrent path | Boolean |
destroy | Remove associated view on route change | Boolean |
Examples
Pokeapi
Last updated