Skip to content

Commit

Permalink
docs(cn): translated code comments in keeping-components-pure into Ch…
Browse files Browse the repository at this point in the history
…inese (#1471)
  • Loading branch information
timingsniper authored Mar 5, 2024
1 parent bea3559 commit 8a7a418
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/content/learn/keeping-components-pure.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ React 的渲染过程必须自始至终是纯粹的。组件应该只 **返回**
let guest = 0;

function Cup() {
// Bad: changing a preexisting variable!
// Bad:正在更改预先存在的变量!
guest = guest + 1;
return <h2>Tea cup for guest #{guest}</h2>;
}
Expand Down Expand Up @@ -773,10 +773,10 @@ li {

```js src/StoryTray.js active
export default function StoryTray({ stories }) {
// Copy the array!
// 复制数组!
let storiesToDisplay = stories.slice();

// Does not affect the original array:
// 不影响原始数组:
storiesToDisplay.push({
id: 'create',
label: 'Create Story'
Expand Down

0 comments on commit 8a7a418

Please sign in to comment.