Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert object to string in react js

How to convert object to string in react js

var numeroToken = this.getSearchParams();

 getSearchParams(k){
         var p={};
         location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(s,k,v){p[k]=v})
         return k?p[k]:p;
    }

I am trying to get the url from getSeatchParms() but it is returned as an object. How can I convert it to a String?

like image 210
Rschary Avatar asked Jul 31 '18 18:07

Rschary


1 Answers

I know this question is out of date, but if someone is looking for the answer (like I was) I could solve it with: JSON.stringify(myObj)

like image 122
Zyl Avatar answered Sep 20 '22 10:09

Zyl