I want to reroute the index /
to /blog
in a gatsby project. The page at /blog
route is generated inside gatsby-node.js
file.
What I tried is importing Redirect
from @reach-router
and inside the Index
component returning Redirect to='/blog'
but this results in Uncaught RedirectRequest
error.
The index.js
file:
import React from 'react'
import { Redirect } from '@reach/router'
class BlogIndex extends React.Component {
render() {
return (
<Redirect to={`/blog`} />
)
}
}
export default BlogIndex