I need to make a button that changes from the text 'Done' to the text 'Update' on hover, ONLY when a true/false flag is true. I had a working method using onMouseOver to detect mouseover and then flip the value using state. However i've been asked to do it via CSS.
I'm having a hard time getting it done with just CSS.
<Button>
<span className={onHoverHide}>Done</span>
<span className={onHoverShow}>Update</span>
</Button>
CSS in JS
onHoverHide: {
display:'auto',
'&:hover':{
display: 'none'
},
},
onHoverShow: {
display:'none',
'&:hover':1
display: 'auto'
},
},
this will make the first span vanish when the TEXT is hovered, but won't make the 2ndary text appear. As well I need it to apply on mouseover to the button, not just the text.
How can I target the span in the button correctly?
onHoverbutton: {
'&:hover': {
'& span': {
display: 'none'
was not successful when applied to the button.