Sakshi
Sakshi

Reputation: 73

Fetch params from search React js

How to fetch params from

props.location.search

where i tried

const { propKey, propEid } =  new URLSearchParams(props.location.search);

but propKey and propEid shows unidentified in console.log

my url is like so:

{{baseurl}}/verify-email?key=a6d16a22a82f16c96ee7d2f95c45c9bc&eid=c2Frc2hpMTFAZ21haWwuY29t

Upvotes: 1

Views: 91

Answers (1)

brijesh-pant
brijesh-pant

Reputation: 1145

const params = new URLSearchParams(props.location.search);
const key = params.get('key'); // a6d16a22a82f16c96ee7d2f95c45c9bc&eid=c2Frc2hpMTFAZ21haWwuY29t

Upvotes: 1

Related Questions