Этого можно достичь, используя состояние , например:
class YourClass extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: false,
}
}
// some code that changes the state to *true*
<Snackbar
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
open={open}
autoHideDuration={this.state.isLoading ? 500 : null}
onClose={(e: any, reason: string) => {
handleClose(e, reason);
}}
>
}