Skip to content

Commit 48e5bd8

Browse files
committed
part 2b
1 parent 33e39f0 commit 48e5bd8

File tree

2 files changed

+88
-97
lines changed

2 files changed

+88
-97
lines changed

src/content/2/en/part2b.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ You can find the code for our current application in its entirety in the <i>part
401401

402402
In the first exercise, we will start working on an application that will be further developed in the later exercises. In related sets of exercises, it is sufficient to return the final version of your application. You may also make a separate commit after you have finished each part of the exercise set, but doing so is not required.
403403

404-
<h4>2.6: The Phonebook Step1</h4>
404+
<h4>2.6: The Phonebook Step 1</h4>
405405

406406
Let's create a simple phonebook. <i>**In this part, we will only be adding names to the phonebook.**</i>
407407

@@ -459,13 +459,13 @@ Note the use of the React developer tools extension in the picture above!
459459
- you can use the person's name as a value of the <i>key</i> property
460460
- remember to prevent the default action of submitting HTML forms!
461461

462-
<h4>2.7: The Phonebook Step2</h4>
462+
<h4>2.7: The Phonebook Step 2</h4>
463463

464464
Prevent the user from being able to add names that already exist in the phonebook. JavaScript arrays have numerous suitable [methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) for accomplishing this task. Keep in mind [how object equality works](https://www.joshbritz.co/posts/why-its-so-hard-to-check-object-equality/) in Javascript.
465465

466466
Issue a warning with the [alert](https://developer.mozilla.org/en-US/docs/Web/API/Window/alert) command when such an action is attempted:
467467

468-
![2.7 sample screenshot](../../images/2/11e.png)
468+
![browser alert: "user already exists in the phonebook"](../../images/2/11e.png)
469469

470470
**Hint:** when you are forming strings that contain values from variables, it is recommended to use a [template string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals):
471471

@@ -487,7 +487,7 @@ newName + ' is already added to phonebook'
487487

488488
Using template strings is the more idiomatic option and the sign of a true JavaScript professional.
489489

490-
<h4>2.8: The Phonebook Step3</h4>
490+
<h4>2.8: The Phonebook Step 3</h4>
491491

492492
Expand your application by allowing users to add phone numbers to the phone book. You will need to add a second <i>input</i> element to the form (along with its own event handler):
493493

@@ -503,11 +503,11 @@ At this point, the application could look something like this. The image also di
503503

504504
![2.8 sample screenshot](../../images/2/12e.png)
505505

506-
<h4>2.9*: The Phonebook Step4</h4>
506+
<h4>2.9*: The Phonebook Step 4</h4>
507507

508508
Implement a search field that can be used to filter the list of people by name:
509509

510-
![2.9 sample screenshot](../../images/2/13e.png)
510+
![2.9 search field](../../images/2/13e.png)
511511

512512
You can implement the search field as an <i>input</i> element that is placed outside the HTML form. The filtering logic shown in the image is <i>case insensitive</i>, meaning that the search term <i>arto</i> also returns results that contain Arto with an uppercase A.
513513

@@ -528,7 +528,7 @@ const App = () => {
528528

529529
This saves you from having to manually input data into your application for testing out your new functionality.
530530

531-
<h4>2.10: The Phonebook Step5</h4>
531+
<h4>2.10: The Phonebook Step 5</h4>
532532

533533
If you have implemented your application in a single component, refactor it by extracting suitable parts into new components. Maintain the application's state and all event handlers in the <i>App</i> root component.
534534

@@ -560,8 +560,6 @@ const App = () => {
560560
}
561561
```
562562

563-
**NB**: You might run into problems in this exercise if you define your components "in the wrong place". Now would be a good time to rehearse
564-
the chapter [do not define a component in another component](/en/part1/a_more_complex_state_debugging_react_apps#do-not-define-components-within-components)
565-
from the last part.
563+
**NB**: You might run into problems in this exercise if you define your components "in the wrong place". Now would be a good time to rehearse the chapter [do not define a component in another component](/en/part1/a_more_complex_state_debugging_react_apps#do-not-define-components-within-components) from the last part.
566564

567565
</div>

0 commit comments

Comments
 (0)