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

176
Vistas
Javascript: Pass argumets to functions

First of all apologies for my non properly elaborated title, I was not sure of the correct name of the functionality.

Considering this cases.

A. From https://github.com/pmndrs/zustand

import create from 'zustand'

const useStore = create(set => ({
  bears: 0,
  increasePopulation: () => set(state => ({ bears: state.bears + 1 })),
  removeAllBears: () => set({ bears: 0 })
}))
B. From https://primefaces.org/primereact/showcase/#/dropdown

<Dropdown value={selectedCity1} options={cities} onChange={(event) => setSelectedCiry1State(event.value)} optionLabel="name" placeholder="Select a City" />

In the first case the function create provides the set variable? that can be used later for example in the removeAllBears: () => set({ bears: 0 } callback.

In the second case the React Component requires a callback for the onChange property, the callback is able to use event and its attributes, like value to execute something.

How does it work? I'm a little bit confused.

PD: I'm already aware that the name of the variables I'm referring to does not matter.

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