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

275
Vistas
Open menu in an array

So im trying to open a menu but the problem is where I am showing the postMenu comp (Posts.js) is an array. So when I show the menu it shows up in all the posts

Posts.comp.js (Where im displaying the postMenu)

  const dispatch = useDispatch();

  const { isLoading, posts, ownerInfo, postsMenuIsOpen } = useSelector(
    (state) => state.posts
  );

// other code...

{posts &&
        posts.map(({ textfield, image, ownerId }) => (
          <div className="px-3 pt-2 pb-1 border border-gray-100 m-1">
            <PostsMenu />
            {ownerInfo &&
              ownerInfo.map(({ _id, displayname, username, profilePic }) => (
                <div>
// html code...

PostsMenu.comp.js (Where the code of menu is)

import React from "react";
import { useSelector } from "react-redux";

function PostsMenu() {
  const { postsMenuIsOpen } = useSelector((state) => state.posts);

  return (
    <div
      className={
        postsMenuIsOpen ? `absolute w-[70%] bg-red-500 z-50` : `hidden`
      }
    >
      PostsMenu
    </div>
  );
}

export default PostsMenu;

Please do let me know if you need more info.

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
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