You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have a little confusion with what is explained in the Effect section about the propagation of data.
Brian says that propagation happens when setBreed("") is called. I understand that, but I decided to comment that line and just call setBreeds([]) instead. Surprisedly, the propagation happened, that means that the BreedDropdown re-rendered.
This is how I let useEffect
This is my main doubt.
Why the BreedDropDown updates? If I updated Breeds only. The main relation I can see between Breeds and BreedDropdown is the statement const [breed, BreedDropdown, setBreed] = useDropdown("Breed", "", breeds);. If some input of the hook is updated, this is re-rendered? or it is just a misunderstanding?
Thank you for reading my issue.
The text was updated successfully, but these errors were encountered:
@piloandres , the BreedDropDown should update even when you updated breeds only, because useDropDown uses the breeds variable as an input, not breed. Commenting setBreed("") just means that you are not setting the value of the selected breed to an empty string from the previous BreedDropdown (before it was re-rendered).
Hello,
I have a little confusion with what is explained in the Effect section about the propagation of data.
Brian says that propagation happens when
setBreed("")
is called. I understand that, but I decided to comment that line and just callsetBreeds([])
instead. Surprisedly, the propagation happened, that means that the BreedDropdown re-rendered.This is how I let useEffect
This is my main doubt.
Why the BreedDropDown updates? If I updated Breeds only. The main relation I can see between Breeds and BreedDropdown is the statement
const [breed, BreedDropdown, setBreed] = useDropdown("Breed", "", breeds);
. If some input of the hook is updated, this is re-rendered? or it is just a misunderstanding?Thank you for reading my issue.
The text was updated successfully, but these errors were encountered: