Rewrote app to use hooks and fixed multiple re-renders.

This commit is contained in:
Patrick Fic
2019-12-11 18:39:27 -08:00
parent 5c7523e6bd
commit f333301f67
16 changed files with 162 additions and 193 deletions

View File

@@ -1,14 +1,16 @@
import React from "react";
import { Route, Redirect } from "react-router-dom";
export default ({ component: Component, isAuthorized, ...rest }) => (
<Route
{...rest}
render={props =>
isAuthorized === true ? (
<Component {...props} />
) : (
<Redirect to="/unauthorized" />
)
}
/>
);
export default ({ component: Component, isAuthorized, ...rest }) => {
return (
<Route
{...rest}
render={props =>
isAuthorized === true ? (
<Component {...props} />
) : (
<Redirect to="/unauthorized" />
)
}
/>
);
};