Last active
March 31, 2017 14:40
-
-
Save marinalimeira/ec53f6ddcaa0a96c66f69248359c7cf2 to your computer and use it in GitHub Desktop.
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
| const PokemonsList = ({ pokemons }) => { | |
| const noPokemons = () => (<ul />); | |
| const pokemonInfo = (pokemon) => ( | |
| <li> | |
| <p><strong>Pokémon:</strong> { pokemon.name }</p> | |
| <p><strong>Type:</strong> { pokemon.type }</p> | |
| </li> | |
| ); | |
| const pokemonsList = () => (<ul id="pokemons-list">{ pokemons.map(pokemonInfo) }</ul>); | |
| return (pokemons.length == 0 ? noPokemons() : pokemonsList()); | |
| } | |
| const pokemons = { | |
| pokemons: [ | |
| { name: 'Haunter', type: 'Ghost/Poison'}, | |
| { name: 'Umbreon', type: 'Dark' } | |
| ] | |
| }; | |
| ReactDOM.render(PokemonsList(pokemons), document.querySelector('#app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment