btholt / btholt/complete-intro-to-react-v5

Propagation state Effects section

Open
#79 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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
Screen Shot 2020-02-18 at 10 31 32 PM

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by rereading the Effect section and tracing the shown useDropdown call with setBreed, setBreeds, breeds, and BreedDropdown. Clarify why updating breeds causes BreedDropdown to re-render, and update the explanation so the relationship is understandable to readers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation, frontend
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.