The data needs to be stored somewhere. To do this, let’s use the
Let’s write two functions to save and read data in the
functions.js file at the root of the project.
Let’s call these functions
setStorage for saving and
readStorage for reading.
setStorage takes two arguments - the data key and the data itself.
The data in
async-storage must be stored as a JSON string under the passed key using the
readStorage must read a method from
async-storage by the key passed to it using the
If there is no data, let’s return
Remember - both methods must be asynchronous and wait for
getItem to execute.
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.