Guest User

Untitled

a guest
Apr 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. // edit or new
  2. class Edit extends React.Component {
  3. constructor(props) {
  4. super(props);
  5. this.state = {
  6. model: {
  7. name: "hoge",
  8. },
  9. }
  10. }
  11.  
  12. onSubmit() {
  13. const model = this.refs.form.getData();
  14. console.log(JSON.stringify(model));
  15. }
  16.  
  17. render() {
  18. const { model } = this.state
  19. return(
  20. <div>
  21. <button onClick={this.onSubmit.bind(this)}>
  22. Save
  23. </button>
  24. <Form model={model} ref="form" />
  25. </div>
  26. );
  27. }
  28. }
Add Comment
Please, Sign In to add comment