Snackbars are displayed in response to something. For example, if a new resource in your application is created, then using a Snackbar component to relay this information to the user is a good choice. If you need to control the state of your snackbars, then you need to add a state that controls the visibility of the snackbar.
Controlling visibility with state
How to do it...
The open property is used to control the visibility of the snackbar. All you need in order to control this property value is a state value that's passed to it. Then, when this state changes, so does the visibility of the snackbar. Here's some code that illustrates the basic idea of state-controlling snackbars:
import React, { Fragment, useState...