Is your feature request related to a problem? Please describe.
I'm trying to convert my Amplify React site to use react-router to route requests to individual pages with, in this case, their own Sumerian scenes.
Describe the solution you'd like
Have option to tell withAuthenticator to wrap the passed component in <BrowserRouter></BrowserRouter>.
Describe alternatives you've considered
Wrote this file, seems to work:
HigherOrderComponents.jsx
import React, {Component} from 'react';
import { BrowserRouter, Link } from 'react-router-dom';
function withRouter(Comp) {
return class extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<BrowserRouter>
<Comp />
</BrowserRouter>
);
}
};
}
export { withRouter };
index.jsx
import App from './App';
const appWithAuthAndRouter = withAuthenticator(withRouter(App));
I sure know how to find the hard way to solve a problem.
Most helpful comment
I sure know how to find the hard way to solve a problem.
https://reacttraining.com/react-router/web/api/withRouter