URLSearchParams ReactJS

I’m trying to do a query to a view in my db and I would to use the URLSearchParams to complete the query’s url.

I need to comunicate with CouchDB View, this is the reason why I should pass a startkey with some params

I have tried in this way:

 let _viewOption = {
        startkey: ['SENDER', values.name, values.surname]
    }
 var url = new URL(myUrlViewLink)
 let params = new URLSearchParams(_viewOption)

What I would to obtain is something like:

myUrlViewLink?startkey=['SENDER',values.name,values.surname]

How can I do?

116 thoughts on “URLSearchParams ReactJS”

Leave a Comment