reactjs / reactjs/react.dev

A section quite vague

Open
#6,293 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

In https://react.dev/learn/responding-to-events#passing-handlers-as-alternative-to-propagation

You could add more code to this handler before calling the parent onClick event handler, too. This pattern provides an alternative to propagation. It lets the child component handle the event, while also letting the parent component specify some additional behavior. Unlike propagation, it’s not automatic. But the benefit of this pattern is that you can clearly follow the whole chain of code that executes as a result of some event.

If you rely on propagation and it’s difficult to trace which handlers execute and why, try this approach instead.

It is somewhat abstract what it is talking about. "You could add more code" -- add more code for what purpose?

"This pattern provides an alternative to propagation" alternative to propagation? Why do I need to rely on propagation in the first place? (and such that I now need an "alternative"?)

"while also letting the parent component specify some additional behavior." What additional behavior?

"But the benefit of this pattern is that you can clearly follow the whole chain of code that executes as a result of some event." Follow the chain? What do you mean?

"If you rely on propagation and it’s difficult to trace which handlers execute and why, try this approach instead." What approach? Why do we "rely on propagation" in the first place?

Can you talk about something specific. Perhaps using an example with specific things. Right now it is quite abstract.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the “Passing Handlers as Alternative to Propagation” section at the linked React documentation URL and compare it with the surrounding event-handling material. Revise the explanation with a specific example that makes the purpose, parent behavior, and execution chain clear, then verify that the quoted abstract statements are understandable to a newcomer.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.