I have this button and playing around withStateHandlers from recompose. The goal is just to change button state from active: false to active: true.
const EnhancedButton = withStateHandlers(
({ initialState = false }) => ({
active: initialState
}),
{
onTrigger: ({ active }) => ({
active: true
})
}
)(({ active, onTrigger, children, id }) => {
console.log(active)
return (
<Button
onClick={() => onTrigger()}
toggle
active={active}
size="massive"
style={styles.button}
as={Link}
to={`/${id}`}
>
{children}
</Button>
)
})
I click on the button, then I get redirected to new page, then I go back and the button is still active: false where I expect it to be active: true