Skip to content

Instantly share code, notes, and snippets.

@persianturtle
Created February 13, 2018 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save persianturtle/08a47f58327c9fdbaa0218674a2fa270 to your computer and use it in GitHub Desktop.
Save persianturtle/08a47f58327c9fdbaa0218674a2fa270 to your computer and use it in GitHub Desktop.
Just the reducer field (solution 1)
reducer: (action, state) =>
switch action {
| Navigate(_routeWithTitle) => ReasonReact.NoUpdate
| ToggleMenu(isOpen) =>
ReasonReact.UpdateWithSideEffects(
{
...state,
nav: {
isOpen: isOpen
}
},
(
_self =>
if (isOpen) {
[%bs.raw
{| document.documentElement.style.overflow = "hidden"|}
];
} else {
[%bs.raw {| document.documentElement.style.overflow = ""|}];
}
)
)
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment