On form/pages we have Button from @material-ui/core
Create a component
Give access to Redux
import * as pageMessageActions from 'store/actions/page-message-actions'
import { Button as MuiButton } from '@material-ui/core'
const Button = ({onClick, text }) => {
const localOnClick = () => {
this.props.pageMessageActions.pageMessage = ''
this.props.onClick()
}
return (
<MuiButton onClick={localOnClick}>text</MuiButton>
)
}
I'm not sure that code is 100% correct but essentially the MuiButton calls a private onClick (localOnClick) and then calls the onClick passed in. The private onClick clears the page message. If needed, the button could have a 'clearPageMessage' prop t/f which if false would not clear the page message. We would need more than one button. At least on for pages like Registration and one for navigation in the menus.
How about this ...
On form/pages we have Button from @material-ui/core
Create a component
Give access to Redux
I'm not sure that code is 100% correct but essentially the MuiButton calls a private onClick (localOnClick) and then calls the onClick passed in. The private onClick clears the page message. If needed, the button could have a 'clearPageMessage' prop t/f which if false would not clear the page message. We would need more than one button. At least on for pages like Registration and one for navigation in the menus.
Let me know what you think