Created
August 24, 2015 19:55
-
-
Save zebulonj/cc63e2737ad80e522be4 to your computer and use it in GitHub Desktop.
React Component Pattern
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
export default function ({ React }) { | |
// Component | |
return function SearchBox( props ) { | |
return { | |
props, | |
render() { | |
const { label, actions } = this.props; | |
return ( | |
<div className="search-box"> | |
<input type="text" ref="params" /> | |
<button type="button" onClick={ this.search }>{ label }</button> | |
</div> | |
); | |
}, | |
search( event ) { | |
const params = React.findDOMNode( this.ref.params ); | |
console.log( "Search Parameters:", params ); | |
} | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment