Created
November 25, 2019 17:37
-
-
Save davidrosenlund/aa726465091c40246056f3d0227a967a 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
| P A R E N T App.js | |
| ###################### | |
| class App extends Component { | |
| state = { | |
| casinos: [], | |
| isbonus: false, | |
| } | |
| callbackFunction = (childData) => { this.setState({isbonus: childData})}; | |
| render() { | |
| return( | |
| <BrowserRouter> | |
| <Fragment> | |
| <li className={ this.state.isbonus ? 'current' : '' }> | |
| <NavLink | |
| exact | |
| to="/bonuses" | |
| data-hover="Alla Bonusar"> | |
| Alla Bonusar | |
| </NavLink> | |
| </li> | |
| <Route exact path="/" component={Home} /> | |
| <Route | |
| exact | |
| path="/bonuses" | |
| component={Bonuses} | |
| parentCallback = {this.callbackFunction} /> | |
| </Fragment> | |
| </BrowserRouter> | |
| ); | |
| } | |
| } | |
| export default App; | |
| C H I L D bonuses.js | |
| ###################################### | |
| class Bonuses extends Component { | |
| state = { | |
| casinos: [] | |
| } | |
| sendData = () => { | |
| this.props.parentCallback(true); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment