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

186
Vistas
reactjs set visible on hover

I have a card that has a button inside it. The button is set visible only when the user hovers the card. The problem is when the user hovers the card, the button is displayed, then if hovering over the button, the button dissapears because the onMouseOut of card reacts and sets the boolean to false.


const Display = (props) => {
    const [isHoveringCard, setIsHoveringCard] = useState(false);
    const [isHoveringButton, setIsHoveringButton] = useState(false);
    const handleMouseOverCard = () => {
        setIsHoveringCard(true);
    };
    const handleMouseOutCard = () => {
        if (!isHoveringButton) {
            setIsHoveringCard(false);
        }
    };
    const handleMouseOverButton = () => {
        setIsHoveringButton(true);
    };
    const handleMouseOutButton = () => {
        setIsHoveringButton(false);
    };
    return (
        <CCard
            style={{ width: '18rem', margin: '20px' }}
            onMouseOver={handleMouseOverCard}
            onMouseOut={handleMouseOutCard}

        >
            <CCardImage
                orientation="top"
                src={props.previewimgname}
                style={{ height: '12rem' }}

            />
            {isHoveringCard &&
                <CButton
                    onMouseOver={handleMouseOverButton}
                    onMouseOut={handleMouseOutButton}
                    className='display-card-button'
                    onClick={() => {
                        props.selectDisplay()
                    }}>
                    Learn More
                </CButton>}
            <CCardBody style={{ height: '10rem' }}>
                <CCardText>
                    <CIcon icon={cilLocationPin} className="me-2" />
                    {props.address}, {props.city}, {props.zipcode}
                </CCardText>
                <CCardTitle>{props.name}</CCardTitle>
                <CCardText>
                    {props.description}
                </CCardText>
            </CCardBody>
        </CCard>
    )
}
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