React Flashcards

(15 cards)

1
Q

How do you get parameters from the URL in React Router?

A

useParams hook

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

Which hook is used to manage state in a functional component?

A

useState

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

Which are synthetic events in React ?

A

onClick, onChange, onBlur

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

Why do we use event.stopPropagation()?

A

To stop the event from bubbling up the DOM tree

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

Which method is used when submitting a form in React?

A

onSubmit

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

What does the value attribute in an input field do?

A

It sets the default/current value of the input field

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

What does onChange do in an input field?

A

Calls a function when the input value changes

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

What is Yup used for?

A

A validation library for JavaScript

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

Which Yup method checks a string using a regular expression?

A

matches()

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

What is ReactJS?

A

A front-end web development library

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

What is a React component?

A

A reusable part of the user interface

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

Which statement is true about functional components?

A

They are defined using a function that returns JSX

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

What is the difference between props and state?

A

Props are immutable; state is mutable

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

Why do we use the key attribute in lists?

A

To give each item a unique identity

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

How do you create a functional component?

A

By writing a function that returns JSX

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