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 })
}))
<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.