You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/learn/editor-setup.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,11 @@ Baadhi ya vihariri huja na maumbile haya yakiwa yamejengwa ndani, lakini vingine
31
31
32
32
### Linting {/*linting*/}
33
33
34
+
<<<<<<< HEAD
34
35
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
35
39
36
40
*[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/))
37
41
*[Unganisha ESLint katika VSCode na kiendelezi rasmi](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
Copy file name to clipboardExpand all lines: src/content/learn/thinking-in-react.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,15 @@ Anza kwa kuchora visanduku kuzunguka kila kijenzi na kijenzi kidogo kwenye kiigi
37
37
38
38
Kulingana na msingi wako, unaweza kufikiria kugawanya muundo katika vijenzi kwa njia tofauti:
39
39
40
+
<<<<<<< HEAD
40
41
***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.
41
42
***CSS**--fikiria ni nini ungetengeneza viteule vya darasa. (Hatahivyo, vijenzi ni vidogo kwa kiasi fulani.)
42
43
***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
43
49
44
50
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.
45
51
@@ -226,10 +232,19 @@ Kilichobaki labda ni hali.
226
232
227
233
Wacha tupitie moja baada ya nyingine tena:
228
234
235
+
<<<<<<< HEAD
229
236
1. Orodha asili ya bidhaa **imepitishwa kama vifaa, kwa hivyo haijabainishwa.**
230
237
2. Maandishi ya utafutaji yanaonekana kuwa ya hali kwani yanabadilika kwa wakati na hayawezi kukokotwa kutoka kwa chochote.
231
238
3. Thamani ya kisanduku cha kuteua inaonekana kuwa hali kwani inabadilika kwa wakati na haiwezi kukokotwa kutoka kwa chochote.
232
239
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
233
248
234
249
Hii ina maana kwamba ni maandishi ya utafutaji pekee na thamani ya kisanduku cha kuteua ndizo zilizotajwa! Imefanywa vizuri!
235
250
<DeepDive>
@@ -262,13 +277,23 @@ In the previous step, you found two pieces of state in this application: the sea
262
277
263
278
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.
264
279
280
+
<<<<<<< HEAD
265
281
Sasa wacha tupitie mkakati wetu kwao:
266
282
267
283
1.**Tambua vijenzi vinavyotumia hali:**
268
284
*`ProductTable` inahitaji kuchuja orodha ya bidhaa kulingana na hali hiyo (maandishi ya utafutaji na thamani ya kisanduku cha kuteua).
269
285
*`SearchBar` inahitaji kuonyesha hali hiyo (maandishi ya utafutaji na thamani ya kisanduku cha kuteua).
270
286
1.**Tafuta mzazi wao wa kawaida:** Kijenzi mzazi cha kwanza ambacho vijenzi vyote viwili hushiriki ni `FilterableProductTable`.
271
287
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
272
297
273
298
Kwa hivyo state thamani zitaishi katika `FilterableProductTable`.
274
299
@@ -456,7 +481,16 @@ function SearchBar({ filterText, inStockOnly }) {
456
481
457
482
Hata hivyo, bado hujaongeza msimbo wowote ili kujibu vitendo vya mtumiaji kama vile kuandika. Hii itakuwa hatua yako ya mwisho.
458
483
484
+
<<<<<<< HEAD
459
485
## 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
460
494
461
495
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`:
Copy file name to clipboardExpand all lines: src/content/learn/tutorial-tic-tac-toe.md
-21Lines changed: 0 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -337,11 +337,7 @@ import './styles.css';
337
337
importAppfrom'./App';
338
338
```
339
339
340
-
<<<<<<< HEAD
341
340
Mstari wa 1-5 unaleta vipande vyote muhimu pamoja:
342
-
=======
343
-
Lines 1-5 bring all the necessary pieces together:
344
-
>>>>>>> 6ec61348646040795fdaa9de14a9bec603260f87
345
341
346
342
* React
347
343
* Maktaba ya React ya kuwasiliana na kivinjari cha wavuti (React DOM)
@@ -555,11 +551,7 @@ export default function Board() {
555
551
}
556
552
```
557
553
558
-
<<<<<<< HEAD
559
554
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
563
555
564
556
Hebu tuangalie:
565
557
@@ -1102,11 +1094,7 @@ function Square({ value, onSquareClick }) {
1102
1094
}
1103
1095
```
1104
1096
1105
-
<<<<<<< HEAD
1106
1097
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
1110
1098
1111
1099
```js
1112
1100
exportdefaultfunctionBoard() {
@@ -2085,22 +2073,13 @@ export default function Game() {
2085
2073
}
2086
2074
```
2087
2075
2088
-
<<<<<<< HEAD
2089
2076
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
2093
2077
2094
2078
<ConsoleBlock level="warning">
2095
2079
Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `Game`.
2096
2080
</ConsoleBlock>
2097
-
<<<<<<< HEAD
2098
2081
2099
2082
Utarekebisha hitilafu hii katika sehemu inayofuata.
0 commit comments