import React from 'react'; import PropTypes from 'prop-types'; import {Link} from 'react-router-dom'; import {Pokemon} from '../../../api'; class PokemonShow extends React.Component { static propTypes = { match: PropTypes.object.isRequired, }; state = { pokemon: {}, }; async componentDidMount() { try { const data = await Pokemon.get(this.props.match.params.id); this.setState({pokemon: data.data}); } catch (err) { // eslint-disable-next-line no-console console.log(JSON.stringify(err, null, 2)); } } render() { return ( <> {this.state.pokemon.id}: {this.state.pokemon.nickname}
404 page
> ); } } export default PokemonShow;