I am using the below snippet for logout in sidemenu. On clicking logout button, it will display a loader and then the logout happens.

I want to add a loader after the alert is shown. How do I achieve it?

```
navigateToLogin = props => {
  Alert.alert(
    "Logout",
    "Are you sure you want to logout?",
    [
      {
        text: "Cancel",
        onPress: () => console.log("Cancel Pressed"),
        style: "cancel"
      },
      {
        text: "OK",
        onPress: () => {
          getCSRFToken(props);
          console.log("5");
        }
      }
    ],
    { cancelable: false }
  );
};

function getCSRFToken(props) {

  AsyncStorage.getItem("USERINFO", (err, res2) => {
    if (res2) {
      let value = JSON.parse(res2);
      getAccessToken(value.csrf_token, props);
      console.log("4");
    } else {
      alert("Your session is expired.");
    }
  });
}

function getAccessToken(csrf_token, props) {

  AsyncStorage.getItem("AccessToken", (err, accessToken) => {
    if (accessToken) {
      logoutFromApp(accessToken, csrf_token, props);
      console.log("3");
    }
  });
}

async function logoutFromApp(authToken, csrf_token, props) {
  const navigateAction = StackActions.reset({
    index: 0,
    actions: [NavigationActions.navigate({ routeName: "LoginTeacher" })]
  });
  console.log("1");
  await axios
    .post(
      "https://abcd.com/logout",
      {},
      {
        headers: {
          "Content-Type": "application/json",
          Authorization: authToken,
          "X-CSRF-Token": csrf_token
        }
      }
    )
    .then(response => {
      alert("LO");
      AsyncStorage.removeItem("USERINFO");
      AsyncStorage.removeItem("AccessToken");
      props.navigation.dispatch(navigateAction);
    })
    .catch(err => {
      console.log("2");
      AsyncStorage.removeItem("USERINFO");
      AsyncStorage.removeItem("AccessToken");
      props.navigation.dispatch(navigateAction);
     // alert(JSON.stringify(err));
    });
}

```

I tried using `this.setState({ isLoading: false });`, but this didn't work.
May I know how to get a loader?