Skip to content

Instantly share code, notes, and snippets.

@zebulonj
Created August 24, 2015 19:55
Show Gist options
  • Save zebulonj/cc63e2737ad80e522be4 to your computer and use it in GitHub Desktop.
Save zebulonj/cc63e2737ad80e522be4 to your computer and use it in GitHub Desktop.
React Component Pattern
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