learnapollo / pokedex-react

A Pokedex App using and teaching Apollo and React
http://learnapollo.com
MIT License
47 stars 16 forks source link

Introduce input change handlers in PokemonCard #7

Open marktani opened 7 years ago

marktani commented 7 years ago
  handleNameChange = e => {
    this.setState({name:e.target.value})
  }

  handleUrlChange = e => {
    this.setState({url:e.target.value})
  }
  render () {
    return (
      <div className='w-100 pa4 flex justify-center'>
        <Card style={{ maxWidth: 400 }}>
          <input
            className='w-100 pa3 mv2'
            value={this.state.name}
            placeholder='Name'
            onChange={this.handleNameChange}
          />
          <input
            className='w-100 pa3 mv2'
            value={this.state.url}
            placeholder='Image Url'
            onChange={this.handleUrlChange}
          />
// ...