I recently started learning React and Gatsby. my page has some URL parameters, how can I get it and put in href attr? Everything works on my local machine. But after gatsby build my variable url = undefined always.
import React from 'react';
const url = typeof window !== `undefined` ? window.location.search : ``;
const Article = ({
content: {
text,
limit,
rate,
term,
link,
logo: {
title,
file: {
URL,
},
},
},
}) => {
return (
<Articles>
<div>
<button className="btn">
<a href={url} target="_blank" rel="noreferrer" id="link-mfo">
Получить деньги
</a>
</button>
</div>
</Articles>
);
};