Skip to content

Instantly share code, notes, and snippets.

@eduard-tkv
Created October 3, 2017 17:26
Show Gist options
  • Save eduard-tkv/94592d77a047c1242c7be9a9fd39e439 to your computer and use it in GitHub Desktop.
Save eduard-tkv/94592d77a047c1242c7be9a9fd39e439 to your computer and use it in GitHub Desktop.
//using ES6
import React from 'react';
class App extends React.Component {
constructor(props) {
super(props)
this.handleClick = this.handleClick.bind(this)
}
handleClick(e) {
e.preventDefault()
this.props.history.push('/redirected');
}
render() {
return (
<div>
<button onClick={this.handleClick}>
Redirect!!!
</button>
</div>
)
}
}
export default App;
@rajbgm
Copy link

rajbgm commented Oct 15, 2019

This is not working.. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment