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

127
Vistas
dispatch to redux when screen size is for I.e. large

I have a confusing issue where I want to update a portion of the state of the header when it gets to screen size large. I'm currently using tailwind so I have the following code:

Where when in mobile view, if the template is not hidden, and the screen size gets to large-- the state should automatically get updated with handleHideTemplates...

That's what I'm attempting to do. I understand with this the handle is fired immediately which I don't want...

in mobile view, if the person hits showTemplates, it hides templates immediately.

  const handleHideTemplates = () => {
    dispatch(setShowTemplates({ hidden: 'hidden' }));
    dispatch(setTemplateMargin({ margin: '' }));
  };

  console.log('hidden', hidden);

  return (
    <header
      className={`text-gray-500 text-semibold text-s fill-accent1 
      top-0 z-30 sticky  lg:grid ${
        'grid' ? handleHideTemplates() : null
      } bg-templateBg px-8 ${margin}`}
    >

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

0

figured it out... instead of conditional inside class..

  useEffect(() => {
    const handleResize = () => {
      if (window.innerWidth >= 1024) {
        handleHideTemplates();
      }
    };

    window.addEventListener('resize', handleResize);

    return () => {
      window.removeEventListener('resize', handleResize);
    };
  }, []);

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