import { useAppSelector } from '../../app/hooks';
import { selectAllBooks } from './booksSlice';

const List: React.FC = () => {
  const books = useAppSelector(selectAllBooks);

  return (
    <table>
      <thead>
        <tr>
          <td>Titel</td>
          <td>Autor</td>
          <td>ISBN</td>
        </tr>
      </thead>
      <tbody>
        {books.map((book) => (
          <tr key={book.id}>
            <td>{book.title}</td>
            <td>{book.author}</td>
            <td>{book.isbn}</td>
          </tr>
        ))}
      </tbody>
    </table>
  );
};

export default List;
