Skip to content

Instantly share code, notes, and snippets.

@mastermoo
mastermoo / mobx-counter-example.js
Last active September 25, 2024 06:51
counter example using mobx
// store.js
import {observable} from 'mobx';
class CounterStore {
@observable counter = 0;
increment() { this.counter++; }
decrement() { this.counter--; }
}
import * as fb from "firebase";
import { computed, observable, runInAction } from "mobx";
type Query = fb.firestore.Query;
type DocumentReference = fb.firestore.DocumentReference;
type DocumentSnapshot = fb.firestore.DocumentSnapshot;
type LoadingDocumentSnapshot = DocumentSnapshot | undefined;
type Dictionary<T> = { [key: string]: T };
// type QuerySnapshot = fb.firestore.QuerySnapshot;
// type LoadingCollectionSnapshot = QuerySnapshot | undefined;