reactjs / reactjs/react.dev

Confusing Variable Naming: "step" & "move"

Open
#4,581 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

At line 1139, jumpTo() requires an argument named step.
However, on lines 1017, and 1106, it passes the variable, move, into jumpTo function, which is confusing.

I think it's better either change the naming of the argument of jumpTo() (:1139),
or switch the naming of currentValue and index of map() (:1017, :1106)

The below PR goes the second way since I think move is more like representing the "movement", on the other hand, step is understood as a "number" in most cases.

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 inspecting jumpTo() at line 1139 and the map() calls at lines 1017 and 1106. Confirm which names are used at each location, then make the naming consistent with the intended meaning and verify the affected code still reads clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.