diff --git a/src/App.js b/src/App.js index 7996303501..1b1e9e3001 100644 --- a/src/App.js +++ b/src/App.js @@ -12,7 +12,9 @@ class BooksApp extends React.Component { } updateBooks = () => { - BooksAPI.getAll().then(books => this.setState({ books })) + BooksAPI + .getAll() + .then(books => this.setState({ books })) } moveBook = (book, shelf) => { @@ -60,38 +62,36 @@ class BooksApp extends React.Component { } componentDidMount() { - this.updateBooks(); + this.updateBooks() } - render() { - return ( -
- ( - - )} - /> - ( - { - this.moveBook(book, shelf) - history.push('/') - }} - /> - )} - /> -
- ) - } + render = () => ( +
+ ( + + )} + /> + ( + { + this.moveBook(book, shelf) + history.push('/') + }} + /> + )} + /> +
+ ) } export default BooksApp diff --git a/src/Book.js b/src/Book.js index 255837bb38..70ab321cca 100644 --- a/src/Book.js +++ b/src/Book.js @@ -2,32 +2,30 @@ import React from 'react' import PropTypes from 'prop-types' import shelves from './Shelves' -const Book = props => { - return ( -
-
-
-
- -
-
-
{ props.title }
-
{ props.authors }
-
- ) -} +const Book = props => ( +
+
+
+
+ +
+
+
{ props.title }
+
{ props.authors }
+
+) Book.propTypes = { image: PropTypes.string.isRequired, diff --git a/src/BooksList.js b/src/BooksList.js index c0c6422fb9..f4d514630b 100644 --- a/src/BooksList.js +++ b/src/BooksList.js @@ -4,34 +4,32 @@ import Link from 'react-router-dom/Link' import Shelf from './Shelf' import shelves from './Shelves' -const BooksList = ({ books, title, onMoveBook }) => { - return ( -
-
-

{ title }

-
-
-
- { - shelves.map(shelf => ( - book.shelf === shelf.key) - } - /> - )) - } -
-
-
- Add a book +const BooksList = ({ books, title, onMoveBook }) => ( +
+
+

{ title }

+
+
+
+ { + shelves.map(shelf => ( + book.shelf === shelf.key) + } + /> + )) + }
- ) -} +
+ Add a book +
+
+) BooksList.propTypes = { books: PropTypes.array.isRequired, diff --git a/src/Shelf.js b/src/Shelf.js index 437119640b..10dbc13d0a 100644 --- a/src/Shelf.js +++ b/src/Shelf.js @@ -2,30 +2,28 @@ import React from 'react' import PropTypes from 'prop-types' import Book from './Book' -const Shelf = ({ shelf, books, onMoveBook }) => { - return ( -
-

{ shelf.title }

-
-
    - { - books.map((book) => ( -
  1. - onMoveBook(book, shelf) } - /> -
  2. - )) - } -
-
+const Shelf = ({ shelf, books, onMoveBook }) => ( +
+

{ shelf.title }

+
+
    + { + books.map((book) => ( +
  1. + onMoveBook(book, shelf) } + /> +
  2. + )) + } +
- ) -} +
+) Shelf.propTypes = { shelf: PropTypes.object.isRequired,