Documentation error in the Render Props - Needs Interpolation
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 11.8k
- フォーク
- 7.9k
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 11
説明
Hi Team,
I am trying to give a small correction in the documentation code of React under the topic Render Props.
This isn't such a big issue, but will definitely help newbies and must be addressed.
Under the Render Props concept in React documentation, in one of the examples, where a class component of Cat is created which returns an image, which is positioned absolutely. The position of that image is received through render props.
The received position coordinates are passed to the absolute positioned image. Now the problem is instead of using interpolation and adding units into it, the position coordinates values are directly given in the style object. Surprisingly the Img still moves respectively to the mouse pointer.
But I don't think giving the values without units is the right thing.
So, the below code should be changed from
From:
render() {
const mouse = this.props.mouse;
return (
<img src="/cat.jpg" style={{ position: 'absolute', left: mouse.x, top: mouse.y }} />
);
}
To:
render(){
const mouse = this.props.mouse;
return (
<img src= './imgs/cat.jpg' style={{ left: ${mouse.x}px, top: ${mouse.y}px}} />
)
}
If my understanding is wrong, please correct me.
Much thanks!
Regards,
Hari prasad
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ReactドキュメントのRender Propsセクションから始め、画像のスタイルでマウス座標を表示しているCatの例を調べてください。周辺のドキュメントとReactの挙動に照らして座標のスタイリングを検証し、そのうえで、ドキュメントに記載された位置指定が正しく、一貫したものになるよう例を更新してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100