React Day 3 Flashcards

1
Q

10:22 - (conditional) ternary operator = handy for …

A

simple things/one line pieces of code/if-else statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

email.read ? ‘email read’ : email

A

if email.read is true then display email read, if false, display only just the email

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

its onchange, onclick, onsubmit, as it is ppointing out the type of button.

A

ie addeventlistener (“click”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

checked={false}
checked={true}
checked={email

A

no checked boxes
all checked boxes
read - checked boxes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

problem: We need to change the checked attribute
solution:

A

I need to update ‘email.read’ via state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

[roblem: When we click the checkbox we should see a chnag ine email.
solution:

A

I need to update ‘email.read’ via state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

you can still carry functions liek function toggleREad ()

But, there’s another way:

A

const toggleRead = ()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do we have that we can use to update state?

A

setword/setEmails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

a function is declared

A

and it is called next to onChange (which is another way of adding an event Listener ) , we then need to pass through an email, so we need to find an object that represents an email. So onchange ={() => toggleRead(email)
Whenever checkbox is clicked, it will display that email on concsole.log
… So now we have the target email in there

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

email.map is not a function

A

we are setting emails with an object when emails is meant to be an array (of emails)
If this eerror appears, make sure you are putting the correct data type in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

.map, .forEach, etc. all of these ……… have …………. running through them

A

.map, .forEach, etc. all of these array methods have for loops running through them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly