Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private saveData = async () => {
- await AsyncStorage.setItem(
- '@appdemo:tasks',
- 'erick',
- JSON.stringify([{ key: 1, text: 'uno' }, { key: 2, text: 'dos' }])
- )
- .then(valor => {
- console.log(valor);
- })
- .catch(error => {
- console.log(error);
- });
- };
- private recoverData = async () => {
- await AsyncStorage.getItem('@appdemo:tasks')
- .then(valor => {
- console.log(valor);
- if (valor !== null) {
- const newtask = JSON.parse(valor);
- this.setState({ tareas: newtask });
- }
- })
- .catch(error => {
- console.log(error);
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement