Skip to content

Instantly share code, notes, and snippets.

@davidrosenlund
Created November 26, 2019 16:53
Show Gist options
  • Save davidrosenlund/e5868ac718b3c401e6f28382ed3d1940 to your computer and use it in GitHub Desktop.
Save davidrosenlund/e5868ac718b3c401e6f28382ed3d1940 to your computer and use it in GitHub Desktop.
import React, { Component, Fragment } from 'react';
import { withRouter, Switch, Route, NavLink, BrowserRouter } from "react-router-dom";
import './App.scss';
class App extends Component {
state = {
casinos: [],
isbonus: false,
}
constructor(props) {
super(props);
}
getNavLinkClass = (path) => {
console.log(this.props.location);
return this.props.location === path ? 'current' : '';
}
//callbackFunction = (childData) => { this.setState({isbonus: childData})};
render() {
return(
<BrowserRouter>
<Fragment>
<div className="main-nav-container">
<img src="/logo.png" className="logo" alt="logo" />
<div className="nav-container">
<ul className="snip1135">
<li className={this.getNavLinkClass("/home")}>
<NavLink exact to="/" data-hover="Start">Start</NavLink>
</li>
</ul>
</div>
<div>
<Route exact path="/" component={Home} />
<Route
exact
path="/bonuses"
component={Bonuses} />
</div>
</Fragment>
</BrowserRouter>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment