Created
September 12, 2016 16:50
-
-
Save ohager/0d51222c61a73fd28a214e52e4aa2155 to your computer and use it in GitHub Desktop.
React Functional stateless component
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
// it's just a function! no createClass or extend React.Component | |
const Value = function(props){ | |
render : { | |
return( | |
<div className={`${props.span} columns`}> | |
<label>{props.label}</label> | |
<input className="u-full-width" type="text" | |
value={props.value} onChange={()=>{}} disabled/> | |
</div> | |
) | |
} | |
}; | |
Value.propTypes = { | |
span : React.PropTypes.string, | |
label : React.PropTypes.string, | |
value : React.PropTypes.any, | |
}; | |
// ... use like this, dude! | |
<div className="form-body"> | |
<div className="row"> | |
<Value span="two" label="Id" value={order.id}/> | |
<Value span="two" label="Internal Order Number" value={order.orderNumber}/> | |
<Value span="two" label="Creation Date" value={order.createDate}/> | |
<Value span="two" label="Laboratory" value={order.laboratory}/> | |
<div className="two columns"> </div> | |
<Value span="two" label="Status" value={order.status}/> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment