tezvyn:

Programmatically change SPA URL without reload and what is state for?

Source: developer.mozilla.orgbeginner

This tests History API fluency. Answer: use pushState or replaceState to change the URL silently; the state object is serializable data tied to the history entry, surfaced through popstate on back or forward navigation.

This tests whether you understand the History API's role in SPA routing. A strong answer names history.pushState() or history.replaceState() to add or update a history entry without fetching a new document, explains that the state argument is any serializable JavaScript object stored alongside that entry, and notes that the browser dispatches a popstate event containing that state when the user later traverses to that entry.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Programmatically change SPA URL without reload and what is state for? · Tezvyn