Skip to content

Commit f920ab6

Browse files
authored
Merge pull request #167 from reactjs/sync-8bb31acb
Sync with react.dev @ 8bb31ac
2 parents a6c7de8 + 197284b commit f920ab6

4 files changed

Lines changed: 794 additions & 71 deletions

File tree

src/content/learn/editor-setup.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Baadhi ya vihariri huja na maumbile haya yakiwa yamejengwa ndani, lakini vingine
3131

3232
### Linting {/*linting*/}
3333

34+
<<<<<<< HEAD
3435
Code linters hupata matatizo katika kodi yako unapoandika, zikikusaidia kuyarekebisha mapema. [ESLint](https://eslint.org/) ni linter maarufu ya chanzo wazi (open source) kwa ajili ya JavaScript.
36+
=======
37+
Code linters find problems in your code as you write, helping you fix them early. [ESLint](https://eslint.org/) is a popular, open source linter for JavaScript.
38+
>>>>>>> 8bb31acb86bf68fa33d97dd0f1b834dfa71e2b1a
3539
3640
* [Sakinisha ESLint kwa mpangilio uliopendekezwa kwa React](https://www.npmjs.com/package/eslint-config-react-app) (hakikisha una [Node imesakinishwa!](https://nodejs.org/en/download/current/))
3741
* [Unganisha ESLint katika VSCode na kiendelezi rasmi](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)

src/content/learn/thinking-in-react.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ Anza kwa kuchora visanduku kuzunguka kila kijenzi na kijenzi kidogo kwenye kiigi
3737

3838
Kulingana na msingi wako, unaweza kufikiria kugawanya muundo katika vijenzi kwa njia tofauti:
3939

40+
<<<<<<< HEAD
4041
* **Programming**--tumia mbinu zile zile za kuamua ikiwa unapaswa kuunda kitendaji kipya au object. Mbinu moja kama hiyo ni [kanuni ya uwajibikaji mmoja (single responsibility principle)](https://en.wikipedia.org/wiki/Single_responsibility_principle), yaani, kijenzi kinapaswa kufanya jambo moja tu. Ikiwa kitaishia kukua, inapaswa kigawanywe kiwe vijenzi vidogo.
4142
* **CSS**--fikiria ni nini ungetengeneza viteule vya darasa. (Hatahivyo, vijenzi ni vidogo kwa kiasi fulani.)
4243
* **Design**--fikiria jinsi unavyoweza kupanga safu za muundo.
44+
=======
45+
* **Programming**--use the same techniques for deciding if you should create a new function or object. One such technique is the [separation of concerns](https://en.wikipedia.org/wiki/Separation_of_concerns), that is, a component should ideally only be concerned with one thing. If it ends up growing, it should be decomposed into smaller subcomponents.
46+
* **CSS**--consider what you would make class selectors for. (However, components are a bit less granular.)
47+
* **Design**--consider how you would organize the design's layers.
48+
>>>>>>> 8bb31acb86bf68fa33d97dd0f1b834dfa71e2b1a
4349
4450
Ikiwa JSON yako imeundwa vizuri, mara nyingi utapata kwamba inaelekeza kwa muundo wa vijenzi vya UI yako. Hiyo ni kwa sababu UI na miundo ya data mara nyingi huwa na usanifu sawa wa habari--yaani, umbo sawa. Tenganisha UI yako katika vijenzi, ambapo kila kijenzi kinalingana na kipande kimoja cha muundo yako wa data.
4551

@@ -226,10 +232,19 @@ Kilichobaki labda ni hali.
226232

227233
Wacha tupitie moja baada ya nyingine tena:
228234

235+
<<<<<<< HEAD
229236
1. Orodha asili ya bidhaa **imepitishwa kama vifaa, kwa hivyo haijabainishwa.**
230237
2. Maandishi ya utafutaji yanaonekana kuwa ya hali kwani yanabadilika kwa wakati na hayawezi kukokotwa kutoka kwa chochote.
231238
3. Thamani ya kisanduku cha kuteua inaonekana kuwa hali kwani inabadilika kwa wakati na haiwezi kukokotwa kutoka kwa chochote.
232239
4. Orodha iliyochujwa ya bidhaa **haijabainishwa kwa sababu inaweza kukokotwa** kwa kuchukua orodha asili ya bidhaa na kuichuja kulingana na maandishi ya utafutaji na thamani ya kisanduku cha kuteua.
240+
=======
241+
1. The original list of products is **passed in as props, so it's not state.**
242+
2. The search text seems to be state since it changes over time and can't be computed from anything.
243+
3. The value of the checkbox seems to be state since it changes over time and can't be computed from anything.
244+
4. The filtered list of products **isn't state because it can be computed** by taking the original list of products and filtering it according to the search text and value of the checkbox.
245+
246+
This means only the search text and the value of the checkbox are state! Nicely done!
247+
>>>>>>> 8bb31acb86bf68fa33d97dd0f1b834dfa71e2b1a
233248
234249
Hii ina maana kwamba ni maandishi ya utafutaji pekee na thamani ya kisanduku cha kuteua ndizo zilizotajwa! Imefanywa vizuri!
235250
<DeepDive>
@@ -262,13 +277,23 @@ In the previous step, you found two pieces of state in this application: the sea
262277

263278
Katika hatua ya awali, ulipata vipande viwili vya hali katika programu hii: maandishi ya ingizo ya utafutaji, na thamani ya kisanduku cha kuteua. Katika mfano huu, daima huonekana pamoja, kwa hiyo ni mantiki kuviweka katika sehemu moja.
264279

280+
<<<<<<< HEAD
265281
Sasa wacha tupitie mkakati wetu kwao:
266282

267283
1. **Tambua vijenzi vinavyotumia hali:**
268284
* `ProductTable` inahitaji kuchuja orodha ya bidhaa kulingana na hali hiyo (maandishi ya utafutaji na thamani ya kisanduku cha kuteua).
269285
* `SearchBar` inahitaji kuonyesha hali hiyo (maandishi ya utafutaji na thamani ya kisanduku cha kuteua).
270286
1. **Tafuta mzazi wao wa kawaida:** Kijenzi mzazi cha kwanza ambacho vijenzi vyote viwili hushiriki ni `FilterableProductTable`.
271287
2. **Amua mahali pa kuishi**: Tutaweka maandishi ya kichujio na thamani za hali zilizochaguliwa katika `FilterableProductTable`.
288+
=======
289+
1. **Identify components that use state:**
290+
* `ProductTable` needs to filter the product list based on that state (search text and checkbox value).
291+
* `SearchBar` needs to display that state (search text and checkbox value).
292+
2. **Find their common parent:** The first parent component both components share is `FilterableProductTable`.
293+
3. **Decide where the state lives**: We'll keep the filter text and checked state values in `FilterableProductTable`.
294+
295+
So the state values will live in `FilterableProductTable`.
296+
>>>>>>> 8bb31acb86bf68fa33d97dd0f1b834dfa71e2b1a
272297
273298
Kwa hivyo state thamani zitaishi katika `FilterableProductTable`.
274299

@@ -456,7 +481,16 @@ function SearchBar({ filterText, inStockOnly }) {
456481
457482
Hata hivyo, bado hujaongeza msimbo wowote ili kujibu vitendo vya mtumiaji kama vile kuandika. Hii itakuwa hatua yako ya mwisho.
458483
484+
<<<<<<< HEAD
459485
## Hatua ya 5: Ongeza mtiririko wa data kinyume {/*step-5-add-inverse-data-flow*/}
486+
=======
487+
488+
## Step 5: Add inverse data flow {/*step-5-add-inverse-data-flow*/}
489+
490+
Currently your app renders correctly with props and state flowing down the hierarchy. But to change the state according to user input, you will need to support data flowing the other way: the form components deep in the hierarchy need to update the state in `FilterableProductTable`.
491+
492+
React makes this data flow explicit, but it requires a little more typing than two-way data binding. If you try to type or check the box in the example above, you'll see that React ignores your input. This is intentional. By writing `<input value={filterText} />`, you've set the `value` prop of the `input` to always be equal to the `filterText` state passed in from `FilterableProductTable`. Since `filterText` state is never set, the input never changes.
493+
>>>>>>> 8bb31acb86bf68fa33d97dd0f1b834dfa71e2b1a
460494
461495
You want to make it so whenever the user changes the form inputs, the state updates to reflect those changes. The state is owned by `FilterableProductTable`, so only it can call `setFilterText` and `setInStockOnly`. To let `SearchBar` update the `FilterableProductTable`'s state, you need to pass these functions down to `SearchBar`:
462496

src/content/learn/tutorial-tic-tac-toe.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,7 @@ import './styles.css';
337337
import App from './App';
338338
```
339339

340-
<<<<<<< HEAD
341340
Mstari wa 1-5 unaleta vipande vyote muhimu pamoja:
342-
=======
343-
Lines 1-5 bring all the necessary pieces together:
344-
>>>>>>> 6ec61348646040795fdaa9de14a9bec603260f87
345341

346342
* React
347343
* Maktaba ya React ya kuwasiliana na kivinjari cha wavuti (React DOM)
@@ -555,11 +551,7 @@ export default function Board() {
555551
}
556552
```
557553

558-
<<<<<<< HEAD
559554
Angalia jinsi, kinyume na `div`s za kivinjari, viungo vyako `Board` na `Square` lazima vianze na herufi kubwa.
560-
=======
561-
Note how unlike the browser `div`s, your own components `Board` and `Square` must start with a capital letter.
562-
>>>>>>> 6ec61348646040795fdaa9de14a9bec603260f87
563555

564556
Hebu tuangalie:
565557

@@ -1102,11 +1094,7 @@ function Square({ value, onSquareClick }) {
11021094
}
11031095
```
11041096
1105-
<<<<<<< HEAD
11061097
Sasa utaunganisha kipengele cha `onSquareClick` na function katika sehemu ya `Board` utakayoita `handleClick`. Ili kuunganisha `onSquareClick` na `handleClick`, utapita function kwa kipengele cha `onSquareClick` cha sehemu ya kwanza ya `Square`:
1107-
=======
1108-
Now you'll connect the `onSquareClick` prop to a function in the `Board` component that you'll name `handleClick`. To connect `onSquareClick` to `handleClick` you'll pass a function to the `onSquareClick` prop of the first `Square` component:
1109-
>>>>>>> 6ec61348646040795fdaa9de14a9bec603260f87
11101098
11111099
```js
11121100
export default function Board() {
@@ -2085,22 +2073,13 @@ export default function Game() {
20852073
}
20862074
```
20872075
2088-
<<<<<<< HEAD
20892076
Unaweza kuona jinsi kanuni yako inavyopaswa kuonekana hapa chini. Kumbuka kwamba unapaswa kuona hitilafu katika koni ya zana za mende inayosema:
2090-
=======
2091-
You can see what your code should look like below. Note that you should see an error in the developer tools console that says:
2092-
>>>>>>> 6ec61348646040795fdaa9de14a9bec603260f87
20932077
20942078
<ConsoleBlock level="warning">
20952079
Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of &#96;Game&#96;.
20962080
</ConsoleBlock>
2097-
<<<<<<< HEAD
20982081
20992082
Utarekebisha hitilafu hii katika sehemu inayofuata.
2100-
=======
2101-
2102-
You'll fix this error in the next section.
2103-
>>>>>>> 6ec61348646040795fdaa9de14a9bec603260f87
21042083
21052084
<Sandpack>
21062085

0 commit comments

Comments
 (0)