Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!