mobx-keystone-asyncstore
An opinionated asynchronous store and container implementation for mobx-keystone.
⚠️WARNING: This library is under development and not yet considered stable. Use with caution as breaking changes to the API may be introduced until reaching v1.
Introduction
One of the most common challenges when implementing a store solution is how to handle asynchronous data sets. mobx-keystone-asyncstore aims to simplify this by allowing you to create powerful asynchronous stores with just a few lines of code. An mobx-keystone-asyncstore implements the most common fetch patterns and support fetch queues, fail states and time to live out of the box.
Let's look at a simple implementation of a TodoStore:
;;;; // Create main model // Create async store; // Create store instance; // Ask the store to return container with id 'foo'; // Wait for the container to be ready to be consumedwhencontainer.isReady,; // Add a new todo to the storetodoStore.addTodo new TodoItem; // Use our custom save methodtodoStore.saveToDb;