Last active
March 1, 2016 14:36
-
-
Save AphonicChaos/1b236acf39c772e63389 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
class StaticForm extends React.Component { | |
render() { | |
return ( | |
<div class="container"> | |
<form> | |
<label for="name">Name</label> | |
<input type="text" id="name"></input> | |
</form> | |
</div> | |
); | |
} | |
} | |
class DynamicForm extends React.Component { | |
constructor(props){ | |
super(props); | |
this.getForm = getForm.bind(this); | |
} | |
render() { | |
this.getForm(function(response) { | |
return ( | |
<div class="container"> | |
{response} | |
</div> | |
); | |
} | |
} | |
getForm(callback) { | |
const result; | |
$.get({ | |
url: "https://secure.my.jobs/myprofile/view/edit/?module=name&id=new" | |
}).done(function(response) { | |
callback(response); | |
}); | |
} | |
} | |
class App extends React.Component { | |
render() { | |
return <StaticForm /> | |
} | |
} | |
class DynamicApp extends React.Component { | |
render() { | |
return <DynamicForm /> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment