'Using .then don't return components

i have problem with .then in my function,code:

export function rightsMenu(token) {
    checkLogin(token).then(r => {
        const isLoggedIn = r.logged;
        if (isLoggedIn) {
            return <MenuLogin avatar={r.avatar} username={r.username} />
        } else return <LoginButton />
    })
}


Sources

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

Source: Stack Overflow

Solution Source