Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda