Closed SimplyComplexable closed 3 years ago
Thanks for the PR!
Could you maybe provide an example of a use case for this change?
@luukdv This will fix trying to set toggle to false
outside of Hamburger context. Example, user navigates to other page and you need to close the mobile menu and set hamburger to initial state (toggle: false).
@mnikolaus That's already possible:
const [toggled, toggle] = useState();
<Hamburger toggled={toggled} toggle={toggle} />
// When user navigates to other page
toggle(false);
Can you provide a code example of the use case that's missing? Thanks!
Closing due to inactivity.
Currently this is done using a ternary, which is incorrectly using
toggleInternal
whentoggle
is set tofalse
. Update to using nullish coallescing to check iftoggle
is defined rather than falsey.