I have implemented notistack snackbar but I would like to read the content of the snackbar onclick.
const action = key => (
<Fragment>
<Button variant="outline-light" onClick={() => { alert(this.state.notice_id) }}>
Dismiss
</Button>
</Fragment>
);
activeNotices.forEach((element) => {
this.setState({notice_id: element.notice_id});
this.props.enqueueSnackbar(element.notice_body + " " + "[" + element.notice_id + "]", {
variant: 'warning',
persist: true,
action,
preventDuplicate: true
});
The above code only alerts the notice_id of a single notice. How do I tie every notice to its specific notice_id? I would like to get the notice_id besides closing the snackbar whenever the dismiss button is clicked.