1// the snackBarState is a string which would represent the key name in the state object
2// i think this is a better way as opposed to doing a {...this.state, ['key]: value}
3// equivalent.
4// Will test this later on which is better. But for now if anyone is looking for this
5// here it is
6public fallbackErrorMessage = (error: any, message: string, snackBarState: string) => {
7
8 let updatedState: any = {
9 loading: false,
10 snackBarState: true,
11 message: message
12 }
13
14 this.setState(updatedState);
15
16 if (error !== undefined) {
17 throw error;
18 }
19 }