How to use the @react-native-community/async-storage.mergeItem function in @react-native-community/async-storage

To help you get started, we’ve selected a few @react-native-community/async-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-native-community / async-storage / example / examples / MergeItem.js View on Github external
name,
      age,
      traits: {trait1, trait2},
    } = this.state;

    const obj = {
      name,
      age,
      traits: {
        trait1,
        trait2,
      },
    };

    try {
      await AsyncStorage.mergeItem(KEY, JSON.stringify(obj));
    } catch (e) {
      console.warn(e);
    }

    this.setState({needRestart: true});
  };
github callstack / async-storage / src / index.mobile.js View on Github external
  mergeItem: key => AsyncStorage.mergeItem(key),
  flushGetRequests: () => AsyncStorage.flushGetRequests(),