Can you please expand on this?
For now, I will share this snippet:
document.addEventListener('state-change', (ev) => { const { key, action } = ev.detail; const state = { key, action }; window.history.pushState(state, null, `/${action}/${key}`); console.log(`triggered state change. action: ${action} key: ${key}`); return handleState(state); });
const event = new CustomEvent('state-change', { detail : { state: state, key: key } }); document.dispatchEvent(event);
For now, I will share this snippet:
And then in your app code (for example, when a user clicks a button), trigger a state change: