Created
August 28, 2018 04:33
-
-
Save DAB0mB/569dddfce7668670bd6e92a4687a6ff2 to your computer and use it in GitHub Desktop.
A sample controller for an Appfairy view
This file contains hidden or 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' | |
import ConsultFormView from '../views/ConsultFormView' | |
class ConsultFormController extends React.Component { | |
state = {} | |
render() { | |
return ( | |
<ConsultFormView> | |
<name onChange={this.setName} /> | |
<phone onChange={this.setPhone} /> | |
<email onChange={this.setEmail} /> | |
<description onChange={this.setDescription} /> | |
<submit onClick={this.submit} /> | |
</ConsultFormView> | |
) | |
} | |
setName = (e) => { | |
this.setState({ | |
name: e.target.value | |
}) | |
} | |
setPhone = (e) => { | |
this.setState({ | |
phone: e.target.value | |
}) | |
} | |
setEmail = (e) => { | |
this.setState({ | |
email: e.target.value | |
}) | |
} | |
setDescription = (e) => { | |
this.setState({ | |
description: e.target.value | |
}) | |
} | |
submit = () => { | |
alert(` | |
${this.name} | |
${this.phone} | |
${this.email} | |
${this.description} | |
`) | |
} | |
} | |
export default ConsultFormController |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment