Skip to content

Instantly share code, notes, and snippets.

@chaintng
Last active October 16, 2016 04:29
Show Gist options
  • Save chaintng/6e66a5f46a227861e4e3f04f37ed63c5 to your computer and use it in GitHub Desktop.
Save chaintng/6e66a5f46a227861e4e3f04f37ed63c5 to your computer and use it in GitHub Desktop.
react-step-2-2.jsx
var Filter = React.createClass({
propTypes: { // 1) assign expected parameter type
onFilterPokemonAtkChange: React.PropTypes.func,
onFilterPokemonTypeChange: React.PropTypes.func,
},
render: function() {
return (<div id="filterBar">
<label>Select Pokemon Type: </label>
<select name="type" id="pokemonTypeFilter" onChange={this.props.onFilterPokemonTypeChange}> {/* 2) assign event listener function for pokemon filter */}
<option value="">- ALL -</option>
<option value="grass">grass</option>
<option value="fire">fire</option>
{/* ... */}
</select>
<label>Input Minimum Attack: </label><input type="text" id="pokemonAtkFilter" onChange={this.props.onFilterPokemonAtkChange} /> {/* 2) assign event listener function for pokemon atk */}
</div>);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment