Tutorial page "Lifting State Up" demo can give incorrect boiling verdict
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 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.

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}
/>

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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从“Lifting State Up”教程页面开始,找到 BoilingVerdict 组件及其用法。检查略低于 212 的 Fahrenheit 值对应的判定,然后更新该组件,并确认 211.9999 不会报告为沸腾,而阈值仍然会报告为沸腾。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100