Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import { Redirect, Link } from 'react-router-dom';
- import style from './nav-button.css';
- class NavButton extends Component {
- constructor(props) {
- super(props);
- this.state = { redirect: false };
- }
- click = () => {
- this.setState({redirect: true})
- }
- render() {
- if (this.state.redirect) {
- return <Redirect to={this.props.nav} />
- }
- return (
- <button className={style.NavButton} onClick={this.click}>
- {this.props.label}
- </button>
- );
- }
- }
- export default NavButton;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement