-
-
Save amandeepmittal/d82466c8ae036fdf43706f04719d0607 to your computer and use it in GitHub Desktop.
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
// Details.js | |
import React, { Component } from 'react'; | |
import { Link } from 'react-router-dom'; | |
import { Col, Row, Container } from '../../components/Grid'; | |
import Jumbotron from '../../components/Jumbotron'; | |
import API from '../../utils/API'; | |
class Detail extends Component { | |
state = { | |
book: {} | |
}; | |
componentDidMount() { | |
API.getBook(this.props.match.params.id) | |
.then(res => this.setState({ book: res.data })) | |
.catch(err => console.log(err)); | |
} | |
render() { | |
return ( | |
<Container fluid> | |
<Row> | |
<Col size="md-12"> | |
<Jumbotron> | |
<h1> | |
{this.state.book.title} by {this.state.book.author} | |
</h1> | |
</Jumbotron> | |
</Col> | |
</Row> | |
<Row> | |
<Col size="md-2"> | |
<Link to="/">← Back to Authors</Link> | |
</Col> | |
</Row> | |
</Container> | |
); | |
} | |
} | |
export default Detail; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment