reactjs / reactjs/react.dev

Tutorial page "Lifting State Up" demo can give incorrect boiling verdict

オープン
#1,983 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

Because the Boiling verdict uses the temperature in celsius , if the user puts in fahrenheit 211.9999 this will incorrectly report that it will boil. This is because the conversion to celsius is limited to 3 digits and gets rounded up to 100.

image

A fix for this is to change BoilingVerdict to accept scale and temperature and the code to do a slightly different check for each:

function BoilingVerdict(props) {
  if (props.scale === 'c' ? props.temperature >= 100 : props.temperature >= 212) {
    return <p>The water would boil.</p>;
  }
  return <p>The water would not boil.</p>;
}

        <BoilingVerdict
          scale={this.state.scale}
          temperature={this.state.temperature} 
          />

image

I know that I could do a fork and pull request but this is about as far as my interest in this subject goes so anyone else is free to fix this admittedly tiny issue.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

「Lifting State Up」チュートリアルページから始めて、BoilingVerdict コンポーネントとその使用箇所を見つけます。212 を少し下回る Fahrenheit 値に対する判定を確認し、その後コンポーネントを更新して、211.9999 では沸騰と報告されず、しきい値の値では引き続き報告されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
documentation
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。