I'm building a website on Gatsby and I will like to be able to render a component conditionally based on which page I am. For example, in the footer I have a component that I don't want it to appear on the "ourcontent" page but yes for the rest of the site.
I tried doing this, which worked, however after running build gives me an error saying:
"window" is not available during server side rendering.
{ window.location.pathname !== '/ourcontent'
? <MyComponent />
: null
}
Im working using a Functional Component.
How would I be able to achieve this? Any help will be extremely appreciated! Thank you very much in advanced!