useLogout
useLogout is used to terminate the authenticated session with the server.

Basic Usage

1
function Component() {
2
const [logout] = useLogout({
3
onSuccess: () => {
4
// do something on success like redirecting
5
// the user to your home page
6
}
7
});
8
9
return (
10
<button onClick={() => logout()}>
11
Click here to logout
12
</button>
13
);
14
}
Copied!

Parameters

onSuccess

Called after the logout operation is successful.
Copy link