astro/.changeset/fresh-pots-draw.md
Martin Trapp 63bc37f2b6
API for clientside router (#8571)
* refactored CSR into goto() function

* first refectoring for router API

* added test

* added comments to fixture

* rename + preliminary changeset

* changeset: now 'minor' and featuring Mathew's example from the docs

* moved for simpler diff

* update after #8617

* fixed ts-errors

* more comprehensible handling of intra-page state

* sync with main

* synch from next_tm
2023-09-27 15:30:13 +02:00

412 B

astro
minor

View transitions can now be triggered from JavaScript!

Import the client-side router from "astro:transitions/client" and enjoy your new remote control for navigation:

import { navigate } from 'astro:transitions/client';

// Navigate to the selected option automatically.
document.querySelector('select').onchange = (ev) => {
  let href = ev.target.value;
  navigate(href);
};