Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
I am trying to use map in my react redux app. but after using useDispatch, the console is showing error

I am working on an app, but I am getting errors in the console. I am sending the picture of the error, along with the code which causes the error. could anyone tell, me what causes this problem?

import React from 'react';
import { useSelector, shallowEqual } from 'react-redux';
import AddBook from './form';
import SingleBook from './singleBook';


const DisplayBooks = () => {
  const books = useSelector((state) => state.booksArray, shallowEqual);

  return (
    <div className="book-list">
      {books.map((book) => <SingleBook key={book.id} title={book.title} author={book.author} />)}
      <AddBook />
    </div>
  )
};

export default DisplayBooks;

Below I have pasted the console image.

image of the console

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think so this line of code is causing the problem

const books = useSelector((state) => state.booksArray, shallowEqual)

Change it to,

const books = useSelector((state) => state.booksArray)
console.log(books) -> to check whether the books is an array or not
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda