Created
November 25, 2019 18:28
-
-
Save davidrosenlund/21489ba2511170090ba3bc5e176ed044 to your computer and use it in GitHub Desktop.
This file contains 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
Parent App.js | |
######################## | |
const BonusContext = React.createContext(false); | |
class App extends Component { | |
static contextType = BonusContext; | |
render() { | |
return( | |
<li className={ this.contaxt ? 'current' : '' }> | |
<NavLink | |
exact | |
to="/bonuses" | |
data-hover="Alla Bonusar"> | |
Alla Bonusar | |
</NavLink> | |
</li> | |
); | |
} | |
} | |
Child component Bonuses.js | |
######################### | |
const BonusContext = React.createContext(true); | |
class Bonuses extends Component { | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment