I get the very common Warning: Each child in an array or iterator should have a unique "key" prop. This is usually very easy to resolve but in this case its just impossible to me to figure out where the issue is created.
My stack trace:
in hoc (created by Connect(hoc))
in Connect(hoc) (at withTranslation.js:7)
in hoc (at ConnectedProtectedRoutes.js:26)
in Route (at ConnectedProtectedRoutes.js:44)
in ProtectedRoutes (created by Connect(ProtectedRoutes))
withTranslation Component
export function withTranslation(CMP) {
var hoc = class extends React.Component {
render() {
return <CMP {...this.props} translate={translate} />
}
};
return hoc;
}
ConnectedProtectedRoutes
const ProtectedRoutes = ({ token, authority, location }) => {
var a = [
createRouteWithRequirements(<Login key="1"/>, "/", [], { token, authority }, true),
createRouteWithRequirements(<Login key="2"/>, "/login", [], { token, authority }),
createRouteWithRequirements(<Register key="3"/>, "/register", [], { token, authority })
]
return a
};
const createRouteWithRequirements = (component, url, requirements, injections, exact) => {
return (
<Route //this is -> in Route (at ConnectedProtectedRoutes.js:44)
exact={!!exact}
key={url}
path={url}
render={() => {
if (requirements.includes("token") && !injections.token) {
return <Redirect to="/login" />
}
return component;
}}
/>
);
};
And the stack goes on but im guessing the issue is somewhere in there. Any clues?