Open
Conversation
| setFilteredContacts(contacts) | ||
| } | ||
|
|
||
| console.log({ term: term }) |
|
|
||
| return fullName.toLowerCase().includes(lowerCaseSearchTerm) | ||
| }) | ||
| console.log({ before_set_contacts: foundContacts }) |
| console.log({ term: term }) | ||
|
|
||
|
|
||
| const lowerCaseSearchTerm = term.toLowerCase() |
There was a problem hiding this comment.
you should also trim,
Will prevent using spaces in your search box.
| "email": email | ||
| } | ||
|
|
||
| console.log(newContactData) |
Comment on lines
+21
to
+23
| let uniqueId = Math.round(Math.random() * 100000000).toString() | ||
|
|
||
| let newContactData = { |
There was a problem hiding this comment.
watch proper usage of const and let.
|
|
||
| contactsApi.addContact(newContactData) | ||
|
|
||
| console.log(contactsApi.all()) |
| } | ||
|
|
||
| const handleClose = () => { | ||
| // router.push('/contacts') |
| { | ||
| label: "First Name", | ||
| className: "mb-3", | ||
| controlId: function () { return `form${this.label.replace(/\s/g, '')}` }, |
There was a problem hiding this comment.
what is this doing?
this.label.replace(/\s/g, '')
Extract to function and name can help readability.
|
|
||
| const formAttributes = { | ||
| formGroups: [ | ||
| { |
There was a problem hiding this comment.
DRY - a lot of repeating code. You could map an array of objects and populate this form groups
| generate_form_groups: function () { | ||
| let formGroups = []; | ||
|
|
||
| this.formGroups.forEach((formGroup) => { |
There was a problem hiding this comment.
using map instead of forEach achieves this.
| }, | ||
|
|
||
| addContact: function (contact) { | ||
| addContact: function (contact: Contact) { |
There was a problem hiding this comment.
The function itself it also needs a type
| get: function (id) { | ||
| const isContact = (c) => c.id === id; | ||
| get: function (id: string) { | ||
| const isContact = (c: Contact) => c.id === id; |
There was a problem hiding this comment.
param has a type, but not the const
| export interface Contact { | ||
| id: string; | ||
| profile_picture: string; | ||
| name?: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.