Skip to content

Instantly share code, notes, and snippets.

@rony-arnac
Last active January 18, 2023 09:53
Show Gist options
  • Save rony-arnac/a0235a2aa7c1d6009b3873bb71988d5e to your computer and use it in GitHub Desktop.
Save rony-arnac/a0235a2aa7c1d6009b3873bb71988d5e to your computer and use it in GitHub Desktop.
example of how Alice and Bob can overwrite each other's data
/**
* data = {
* balance: 100,
*. addresses: ['0x1', '0x2']
* }
*/
// Alice (1)
const aliceData = await getComplexData();
// Bob (1)
const bobData = await getComplexData();
// Alice (2)
aliceData.balance = 90;
await setComplexData(aliceData);
// Bob (2)
bobData.addresses.push('0x3');
await setComplexData(bobData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment