Skip to content

Commit

Permalink
added render check to book detail
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jan 1, 2016
1 parent 63d3b8a commit 879db70
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion book_list/src/containers/book-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ import { connect } from 'react-redux';

class BookDetail extends Component {
render() {
if (!this.props.book) {
return <div>Select a book to get started.</div>;
}

return (
<div>Book Detail!</div>
<div>
<h3>Details for:</h3>
<div>Title: {this.props.book.title}</div>
<div>Pages: {this.props.book.pages}</div>
</div>
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions book_list/src/reducers/reducer_books.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default function() {
return [
{ title: 'Javascript: The Good Parts' },
{ title: 'Harry Potter' },
{ title: 'The Dark Tower' },
{ title: 'Eloquent Ruby' }
{ title: 'Javascript: The Good Parts', pages: 101 },
{ title: 'Harry Potter', pages: 39 },
{ title: 'The Dark Tower', pages: 85 },
{ title: 'Eloquent Ruby', pages: 1 }
];
}

0 comments on commit 879db70

Please sign in to comment.