'redirect after login and signout firebase auth

I want to make a redirect when the google auth login is successful. But I cannot use Route inside another Route in my case, because I am using it in another component :

class Shop extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            ...initialState, isLogged: false,
        }
    }
    authListener = null;
    componentDidMount() {
        this.authListener = auth.onAuthStateChanged(userAuth => {
            if (!userAuth) {
                return;
            }

            this.setState({
                currentUser: userAuth,
                isLogged: true,
            })

How possibly can I make the redirection after login and logout ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source