Repository navigation
Replies: 1 comment
|
Use a function that returns fresh initial state, then pass it through const makeInitial = () => ({
collections: [],
collectionsLength: 0
});
const [collectionStore, setCollectionStore] = createStore(makeInitial());
function resetCollections() {
setCollectionStore(reconcile(makeInitial()));
}The fresh object matters because the object passed to An object is convenient when the collection has additional state, such as loading/error information. A top-level array is fine if the array itself is all you need. Reset that form with: setCollections(reconcile([]));If |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I have two questions.
All reactions