Skip to content

Instantly share code, notes, and snippets.

@saidimu
Created August 26, 2015 17:19
Show Gist options
  • Save saidimu/2758402f7916f4e35dee to your computer and use it in GitHub Desktop.
Save saidimu/2758402f7916f4e35dee to your computer and use it in GitHub Desktop.
A ReactJS redirect component for STML/react-router-component
// jshint unused:true
var React = require('react');
var NavigatableMixin = require('react-router-component').NavigatableMixin;
var Redirect = React.createClass({
mixins: [NavigatableMixin],
_redirect: function(url) {
this.navigate(url);
},
propTypes: {
url: React.PropTypes.string.isRequired,
},
componentDidMount: function() {
console.log('Redirecting to %s: ', this.props.url);
this._redirect(this.props.url);
},
render: function() {
return null;
}
});//Redirect
module.exports = Redirect;
@przeor
Copy link

przeor commented Aug 29, 2016

Hi I see that you use React, so I am sure that you will find interesting the https://reactjs.co - this is the free online convention and tutorial book for React.JS Developers. React is not only the View (in MVC) anymore. ReactJS For Dummies: Why & How to Learn React Redux, the Right Way.

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