todos-contra-el-fuego-web/imports/ui/components/Public/Public.js
vjrj a997aa7cae cleanup: silence our own React dev-console warnings
UNSAFE_ rename of our 4 componentWillReceiveProps (FireStats, Fires, FromNow,
SelectionMap) and Authenticated/Public component propType func -> elementType.
Rest of the console noise is legacy react-* dev-mode warnings, absent in prod.
2026-07-18 05:47:44 +02:00

27 lines
666 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { Route, Redirect } from 'react-router-dom';
const Public = ({
loggingIn, authenticated, component, location, path, exact, ...rest
}) => (
<Route
path={path}
exact={exact}
render={props => (
!authenticated ?
(React.createElement(component, {
...props, ...rest, loggingIn, authenticated
})) :
(<Redirect to={{ pathname: '/subscriptions', state: location.state }} />)
)}
/>
);
Public.propTypes = {
loggingIn: PropTypes.bool.isRequired,
authenticated: PropTypes.bool.isRequired,
component: PropTypes.elementType.isRequired
};
export default Public;