Home > front end >  Remove data from string which come from url
Remove data from string which come from url

Time:10-27

I have a problem with decode URL. Instead my URL always return space ' '. I want to prevent it and return ( sign plus ) if exist.

CodePudding user response:

Because plus is not use in params... params change the plus in space

CodePudding user response:

let assume the params is www.somewebsite.com?name=+somename

  const params = new URLSearchParams(props.location.search);

  console.log(params);

the console log look like this somename

  •  Tags:  
  • url
  • Related