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

115
Vistas
Console.Logging an OnClick Event not working with Mapped State

I've mapped some redux state across my app and am looking to when I select the text, it will create a console.log of the text. My eventual goal is to use this with useSelector and dispatch updates to the Redux store, but that's another question for another day.

I have created the following jsx:

    const searchResults = useSelector(state => state.jobsearch.roles.map(role => role.title))

    const SearchResultsText = ({ text }) => {
        return (
            <JobContainer>
                <JobSearchTypography>
                    {text}
                </JobSearchTypography>
          </JobContainer>
        );
      };

And have it within my app as such, which works!

           <JobContainer >
                {searchResults && searchResults.length < 3 && searchResults.map((result) =>
                    (<SearchResultsText text={result}/>)
                )}
                </JobContainer>

Now I have also created the following function e.g

   function handeClickRoleSelection() {
        console.log('you have clicked on')
    }

When I select on one of the following, i'd like to return in console.log, 'you have clicked on', title - but am unsure how to do this. I have tried applying the handleClickRoleSelection on each element of the jsx but nothing.

I have tried it with a basic p tag and it is functional. Where am I slipping up?

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