redux-burger-menu icon indicating copy to clipboard operation
redux-burger-menu copied to clipboard

closing the menu won't fire redux action

Open minotaurrr opened this issue 6 years ago • 1 comments

Hi,

I noticed no redux action is fired when I close the menu.

class SideMenu extends React.Component {
    componentDidMount() {}
    render() {
        return (
            <Menu
                customBurgerIcon={false}
                isOpen={this.props.isOpen}
                pageWrapId={'page-wrap'}
                outerContainerId={'outer-container'}
            >
                <span>test</span>
            </Menu>
        );
    }
}

const mapStateToProps = state => ({
    isOpen: state.burgerMenu.isOpen,
});

export default connect(mapStateToProps)(reduxBurgerMenu(SideMenu));

I have another component that has a button which fires the toggleMenu action like so:

class AnotherClass..... {
    render() {
        return(
            ....<Button onClick={() => toggleMenu(isOpen)}>Open Menu</Button>
        )
    }
}

I'm using the following

"react": "^16.6.0",
"react-redux": "^5.1.0",
"redux": "^4.0.1",
"redux-burger-menu": "^0.2.8",
"react-burger-menu": "^2.5.4",

The initial state for isOpen is false so the button works only the first time. When the menu is closed isOpen stays true since no action is fired so the button doesn't work anymore.

Anyone experienced a similar issue?

minotaurrr avatar Nov 21 '18 04:11 minotaurrr

#7 This workaround worked for me

minotaurrr avatar Nov 26 '18 23:11 minotaurrr