Created
September 16, 2016 23:55
-
-
Save ryanflorence/d7ecaf57d8518b0b969502928567c98a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ToggleDisplayMatch = ({ component: Component, ...rest }) => ( | |
<Match {...rest}> | |
{({ matched, ...props }) => ( | |
<div style={{ display: matched ? 'block' : 'none' }}> | |
<Component {...props}/> | |
</div> | |
)} | |
</Match> | |
) | |
// then use it like this: | |
<ToggleDisplayMatch pattern="/whatever" component={WhateverPage}/> | |
<ToggleDisplayMatch pattern="/stuff" component={Stuff}/> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@steida If swapping components results in massive diffs, that pauses the app for a long time with no feedback after clicking a link. Swapping
block
/none
would almost remove that delay.