Creating a reusable “Token Manager” class in react-native.

Creating a reusable “Token Manager” class in react-native.

In any app, especially an app that has user accounts, it is a very common task to check for existing user token and redirects the user either to AuthStack or AppStack according to the token found. So for this common task, we can create our own token manager class which handles the common functionalities related to user token. In today's code read I will try to document that. Usually, we store tokens locally in our AsyncStorage, so we have 2 functions in our class. One is to set and the other one is to clear the token. Now the next…