Skip to content

Instantly share code, notes, and snippets.

@islahul
Last active June 15, 2017 23:19
Show Gist options
  • Save islahul/73f99302a721a714c002 to your computer and use it in GitHub Desktop.
Save islahul/73f99302a721a714c002 to your computer and use it in GitHub Desktop.
React double colon meaning JSX usage
import './login.styl';
import Component from '../components/component.react';
import React from 'react';
import exposeRouter from '../components/exposerouter.react';
import {focusInvalidField} from '../lib/validation';
@exposeRouter
export default class Login extends Component {
static propTypes = {
// Something here
};
onFormSubmit(e) {
e.preventDefault();
const {actions: {auth}, auth: {form}} = this.props;
// Something here
}
redirectAfterLogin() {
}
render() {
const {
actions: {auth: actions},
auth: {form},
msg: {auth: {form: msg}}
} = this.props;
return (
<div className="login">
// This is binding the function onFormSubmit to this fn.bind(this)
<form onSubmit={::this.onFormSubmit}>
</form>
</div>
);
}
}
@BrennerSpear
Copy link

thank you for this

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