Skip to content

Instantly share code, notes, and snippets.

@pixelkritzel
Created September 26, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelkritzel/a79dc3dad1382ab0ee50 to your computer and use it in GitHub Desktop.
Save pixelkritzel/a79dc3dad1382ab0ee50 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import template from './MyComponentsTemplate';
export class MyComponent extends Component {
/* skipping all this */
render() {
retun template.call(this)
}
}
import React, { Component } from 'react';
export class MyComponent extends Component {
constructor(props) {
super(props);
this.state = {
foo: "foo",
bar: "bar"
}
}
handleFormSubmit(event) {
event.preventDefault();
/* ... */
}
render() {
return(
<form onSubmit={ this.handleFormSubmit.bind(this) } >
<input type="text" value={ this.foo } ref="foo" />
<button type="submit">Go!</button>
</form>
)
}
}
import React, { Component } from 'react';
var template = function template() { return(
<form onSubmit={ this.handleFormSubmit.bind(this) } >
<input type="text" value={ this.foo } ref="foo" />
<button type="submit">Go!</button>
</form>
)}
export class MyComponent extends Component {
constructor(props) {
super(props);
this.state = {
foo: "foo",
bar: "bar"
}
}
handleFormSubmit(event) {
event.preventDefault();
/* ... */
}
render() {
return(
return template.call(this);
)
}
}
import React from 'react';
var template = function(){return(
<form onSubmit={ this.handleFormSubmit.bind(this) } >
<input type="text" value={ this.foo } ref="foo" />
<button type="submit">Go!</button>
</form>
)}
export default template;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment