Practice ยท 1 of 2
URL to View State
Write viewFromUrl(url) โ parse a full URL (use the URL constructor) and return { route, id, query }. route is the pathname without the leading slash; id is the value of /:id segments for paths like "products/42" (null otherwise); query is an object of searchParams (empty object when none).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: URL & History โ Practice