Last active
October 16, 2016 04:12
-
-
Save chaintng/f4556fa24a12a48965b716dba3057eec to your computer and use it in GitHub Desktop.
react-step-1.jsx
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
var Result = React.createClass({ | |
render: function() { | |
return (<div> | |
<div>--- Total Filter Pokemon: {this.props.filterPokemon.length} ---</div> | |
<ul> | |
<li></li> {/* how each pokemon display */} | |
</ul> | |
</div>); | |
} | |
}); | |
var Filter = React.createClass({ | |
render: function() { | |
return (<div id="filterBar"> | |
<label>Select Pokemon Type: </label> | |
<select name="type" id="pokemonTypeFilter"> | |
<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"/> | |
</div>); | |
}, | |
}); | |
var Pokedex = React.createClass({ | |
render: function() { | |
var filterPokemon = this.filterPokemonByTypeAndMinAtk(allPokemons, this.state.filterPokemonType, this.state.filterPokemonAtk); | |
return (<div> | |
<Filter /> | |
<Result /> | |
</div>); | |
} | |
}); | |
ReactDOM.render(<Pokedex />, document.getElementById('reactOutput')); // Render Pokdex component to html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment