Published
- 1 min read
typescript read url parameters
The solution for this is noted below
typescript read url parameters
Solution
// get all search params (including ?)
const queryString = window.location.search;
// it will look like this: ?product=shirt&color=blue&newuser&size=m
// parse the query string's paramters
const urlParams = new URLSearchParams(queryString);
// To get a parameter simply write something like the follwing
const paramValue = urlParams.get('yourParam');
Try other methods by searching on the site. That is if this doesn’t work