Url query Reach Route - React

Asked

Viewed 1,106 times

0

I have the following problem:

I have an API in Node.js that returns me id and name of products and supermarkets When I get into /supermarkets via params url /:idSupermercado I can get this parameter in the component by this.props.idSupermercado. So far ok.

I’d like to know how to get a query url.

Ex: the link at the end would look like this localhost:3000/search/idSupermercado/? product=potato

How do I get this ? product=potato in the Komponent?

I’m using Reach router to work with the routes

1 answer

1

In case, to get the queryParams, you can access this.props.location.search.

Will come in format ?produto=batata, then only format. Even, you can use other libs to make the conversion pa

Browser other questions tagged

You are not signed in. Login or sign up in order to post.