I have the session id in {this.state.session}
.
I want to call that session state throughout the application by set cookie or to store the asyncstorage.
Can you please give the code to set asyncstorage or set cookie?
I have the session id in {this.state.session}
.
I want to call that session state throughout the application by set cookie or to store the asyncstorage.
Can you please give the code to set asyncstorage or set cookie?
I'd suggest you to use a state management library such as Redux which will enable you to access the variable anywhere in your application through props. If you still need to store your session Id in asyncStorage, Here is the code
try {
await AsyncStorage.setItem('SessionId', this.state.session);
} catch (error) {
// Error saving data
}
try centralizing it to the store so that you don't access asyncStorage everywhere.