import React from 'react'; import { Route, Redirect } from 'react-router-dom'; import { connect } from 'react-redux'; export default function PrivateRoute(props) { const { path, utente, component: Component } = props; return ( ( utente ? : )} /> ); } const mapStateToProps = (state) => ({ utente: state.account.utente }); PrivateRoute = connect(mapStateToProps)(PrivateRoute);