reactjs / reactjs/react.dev

initialCount is not defind for useReducer

Open Beginner friendly
#1,931 1 comment 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

Hi
Most programmers copy-paste the examples and play around with them until they learn how to use the API.
On the sample code given here the code does not work because the initialCount is not defined.
It should be fixed like this:
function init(initialCount) { return {count: 0}; }

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

Open the Hooks Reference lazy initialization example linked in the issue and inspect the sample around useReducer. Update the example so its initialCount reference is defined, then verify that the displayed sample is self-contained and works as documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.