Question mark inside react router path
How did I solved this issue.
http://localhost:3000?token=mypetismissing
export default function ({ location }) { const urlParams = new URLSearchParams(location.search); const token = urlParams.get('token'); console.log(myParams) return ( <div> {token} </div> )}
You need query-string
Example:http://yoursite.com/page?search=hello
const queryString = require('query-string')class ProductsPage extends React.Component { componentDidMount() { let search = queryString.parse(this.props.location.search).search console.log(search) // ==> hello }...}