Last active
August 3, 2017 00:39
-
-
Save sirgallifrey/70f71fe7d5e55a029b33aff964775a6c to your computer and use it in GitHub Desktop.
specialized components
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 Label from './label'; | |
import Input from './input'; | |
function Field (props) { | |
return ( | |
<div className="form-group"> | |
<Label>{props.label}</Label> | |
<Input type={props.type} onChange={props.onChange} value={props.value}/> | |
</div> | |
); | |
} |
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 Field from './field'; | |
class Index extends React.Component { | |
handleChange = () => { | |
//update field state | |
} | |
render() { | |
return ( | |
<form> | |
<Field label="Nome" type="text" onChange={this.handleChange}/> | |
<Field label="Email" type="email" onChange={this.handleChange}/> | |
<Field label="Telephone" type="tel" onChange={this.handleChange}/> | |
</form> | |
); | |
} | |
} |
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'; | |
function Input (props) { | |
return ( | |
<input {...props}/> | |
); | |
} |
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'; | |
function Label (props) { | |
return ( | |
<label className="form-label">{ props.children }</label> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment