reactjs / reactjs/react.dev

Why don't we mention the concept of callBack props in the 'Lifting State Up' page?

Open
#5,306 0 comments 0 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

There are times the source of the detailed or complete data is best isolated in a child component rather than trying to lift the state up and creating large parent component. The large parent component that has all the state, goes against the concepts of code isolation and separation of concerns,

Given this, why not add a note to https://reactjs.org/docs/lifting-state-up.html that talks about callback props?
There are 3 issues i'm aware of with callback props:

  1. that warning that the parent component is still rendering: solution: launch the event handler code asynchronously
    2): In async functions, after await(), we should check whether the component is still mounted.
    3): whenever a function is passed as a prop it must be frozen and then only added to the useEffect() dependency chain (better to add all dependencies for useEffect rather than ignore the warning)

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 with the “Lifting State Up” page at reactjs.org/docs/lifting-state-up.html and review how callback props relate to its guidance. Evaluate the three concerns listed in the issue and determine whether an accurate note belongs in the page. Done means the documentation includes a clear, technically supported explanation or the issue’s proposed addition is declined with rationale.

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.