reactjs / reactjs/react.dev

Notifying the readers about the change in default value in context example

Open
#6,036 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

The example given for context (Passing Data Deeply with Context) starts with a default value of 1. Later on, for explaining 'Using and providing context from the same component', it is changed to 0 and remains the same for a later subtopic too.
While I was going through the example, I was left confused about how the code (shown in the below screenshot) is working given that the default value is set to 1 until I checked the 'LevelContext.js'.

highlighted-code

While one can look at the 'LevelContext.js' and check, I think it would be better to make readers aware of the change! We can add a small sentence like 'Note that the default value is changed to 0'

context-default-value-issue

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 in the “Passing Data Deeply with Context” example and compare its displayed default value with LevelContext.js, then read the “Using and providing context from the same component” subsection. Add a brief note where the example changes to 0, and confirm the later subsection remains consistent with that explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.