How do I get the current url in Gatsby?
You can get the current url using the location prop from the @reach/router Location component. import PropTypes from ‘prop-types’; import React, { Component } from ‘react’; import { Location } from ‘@reach/router’; class SomeComponent extends Component { static propTypes = { location: PropTypes.object.isRequired } render() { const { location } = this.props; return <div>{JSON.stringify(location)}</div>; } … Read more