I currently have a react app using react-router-dom
that works locally but not when deployed using AWS Amplify.
The problem is that when I route to a URL and use query strings, the browser gets a redirect and drops the query strings.
For example when I route to /path?value1=foo&value2=bar
, the browser gets a 301 and redirects to url: /0000000X/path/
as shown below
I have tried using hash values as well as the /path/?value1=foo&value2=bar
approach as mentioned in this post with no luck.
Below is my implementation:
Button.js
href: '/path?value1=foo&value2=bar'
Path.js
import queryString from 'query-string'
const values = queryString.parse(this.props.location.search)
console.log(values.value1)
console.log(values.value2)
Routes.js
<AuthenticatedRoute path="/path" exact component={Path} props={childProps} />
All of this works fine locally, redirects and I can access the query string params, but not in S3. Thanks in advance!