reactjs / reactjs/react.dev

Warning about FooterLink keys in dev

未關閉
#472 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
JavaScript
星號
11.8k
分支
7.9k
平均合併
1 天 11 小時
30 天內合併 PR
11

描述

There is a warning in the browser console when running the project in development mode. The warning can be fixed by adding a key prop to FooterLink elements here and here. If this should be fixed I will submit a PR to do so.

Warning text:

index.js:2177 Warning: Each child in an array or iterator should have a unique "key" prop.

Check the render method of `Footer`. See https://fb.me/react-warning-keys for more information.
    in FooterLink (at Footer.js:67)
    in Footer (at index.js:69)
    in div (at index.js:45)
    in Template (at index.js:6)
    in _default (created by ComponentRenderer)
    in ComponentRenderer (created by Route)
    in Route (created by withRouter(ComponentRenderer))
    in withRouter(ComponentRenderer) (created by Root)
    in ScrollContext (created by Route)
    in Route (created by withRouter(ScrollContext))
    in withRouter(ScrollContext) (created by Root)
    in Router (at root.js:143)
    in DefaultRouter (created by Root)
    in Root (at app.js:45)
    in AppContainer (at app.js:44)

Steps to reproduce:

  1. Checkout master branch
  2. Run yarn dev
  3. Navigate to localhost:8000 and look in the browser console

Browser: Chrome 63
OS: MacOS 10.13.1

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

開啟 src/components/LayoutFooter/Footer.js,找到第 67 行和第 115 行的 FooterLink 元素,然後執行 yarn dev 並造訪 localhost:8000。確認瀏覽器主控台不再回報缺少唯一 key 的警告。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, react
領域
frontend
Issue 類型
缺陷
難度
1/5
預估耗時
1 小時以內
活躍度
停滯
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。