When loading an otherwise correctly working React App in IE 11, with Adobe Analytics in the same page, it gives the error message:
Invariant Violation: You should not use <Switch> outside a <Router>
The error doesn't appear on all other browsers, and ONLY IE 11 is affected. It is also independent of the Router type that I am using.
If I take Adobe Analytics out => it works.
Here is the code that I am using:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test Page</title>
<SCRIPT src="//assets.adobedtm.com/<hash>-staging.js"
></SCRIPT>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="reactRoot"></div>
</body>
</html>
Here is the React-Router Section with the polyfills i am Using
require('babel-polyfill');
require('es6-promise').polyfill();
class AppRouter extends Component {
render() {
return (
<Router>
<ErrorBoundary>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/type/:type/:lang?" component={FormContainer} />
<Route path="/success/:type/:lang?" component={SuccessContainer} />
<Route path="/error/:code?" component={ErrorContainer} />
<Route component={NotFound} />
</Switch>
</ErrorBoundary>
</Router>
);
}
}
My goal is the make it render in IE 11