Last active
May 3, 2018 21:16
-
-
Save jamesplease/aad2638b5e90feaacc33c099de6464d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deep merge | |
update('resources.books', { | |
24: { | |
attributes: { | |
firstName: 'james' | |
} | |
} | |
}); | |
// Do some shit | |
update('resources', { | |
books: { ... }, | |
authors: { ... } | |
}); | |
getResources('books', {team: 'red'}); | |
getList('favoriteBooks'); | |
<List name="favoriteBooks"> | |
{() => {}} | |
</List> | |
<Resources type="books" filter={}> | |
{({ update }) => { | |
}} | |
</Resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update({ | |
resources: { | |
books: [{}, {}], | |
authors: { | |
24: { ... } | |
} | |
}, | |
lists: { | |
favorites: [{}, {}, {}] | |
} | |
}); | |
update('resources.books.24.attributes.name', { | |
firstName: 'Stephen', | |
initial: 'R' | |
}, {merge: false}); | |
remove('lists.favoriteBooks'); | |
remove('lists.favoriteBooks', [2]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateBooks(path, update) { | |
return store.update(`resources.books.${path}`, update); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment