Last active
September 21, 2015 15:20
-
-
Save clalimarmo/16e36f8a5fd939240e21 to your computer and use it in GitHub Desktop.
Deep Linking with React + Flux, AppLink component, updated to support browser "back"
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
AppLink = React.createClass({ | |
render: function() { | |
return ( | |
<a href={this.props.href} onClick={this.onClick}> | |
{this.props.children} | |
</a> | |
); | |
}, | |
onClick: function(event) { | |
event.preventDefault(); | |
Dispatcher.dispatch({ | |
type: 'navigate', | |
path: this.props.href, | |
// following this link should create a history entry | |
pushState: true, | |
}); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment