Support Forums

Query params not rendering on page


I am using Gatsby and React for a website.

I want to display the query params from the URL on the page. I have something like:

const IndexPage () => {
     const params = new URLSearchParams(location.search);
     const DOI = params.get("doi");

     return (

where the URL is https://apsum.netlify.app/?doi=123, for example.

I want 123 to display on the page, but it is not.

I had a redirect in my netlify.toml file.

Commenting this out solved the problem.

1 Like