Class State<StateSchema>

The state class takes in a StateSchema defined as whatever you want it to be. It allows for access anywhere from the program.

Type Parameters

  • StateSchema

Constructors

Accessors

Methods

Constructors

  • Type Parameters

    • StateSchema

    Parameters

    • initialState: StateSchema

      The StateSchema that the class will follow

    Returns State<StateSchema>

     interface StateSchema {
    myString: string | null;
    favoriteNumber: number;
    }

    const defaultState: StateSchema = {
    myString: null,
    favoriteNumber: 3,
    };

    export const state: State<StateSchema> = new State(defaultState);

Accessors

Methods