Adds a custom store to the root store.
The name of the custom store.
The class of the custom store.
GPT Context: This method allows developers to add custom store classes to the root store dynamically, providing flexibility to extend the store with additional functionality.
Example:
import { makeAutoObservable, action } from "mobx";
import { CDF } from "./index";
class CustomStore {
rootStore: CDF;
customValue = "custom value";
constructor(rootStore: CDF) {
this.rootStore = rootStore;
makeAutoObservable(this);
}
@action setCustomValue(value: string) {
this.customValue = value;
}
}
store.addStore("customStore", CustomStore);
The root store that manages all individual stores. GPT Context: This class serves as the root store, providing a single point of access to all individual stores within the application. It initializes and manages following instances of stores: