Testing & Best Practices Flashcards

1
Q

Which libraries are commonly used for testing React applications?

A

Jest and React Testing Library.

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

How would you mock a module during testing in Jest?

A

Using jest.mock().

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

What is the main principle of the React Testing Library?

A

The more your tests resemble the way your software is used, the more confidence they can give you.

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

What are some best practices when writing React components?

A

Keep components small and focused, favor functional components, lift state up when needed, and make components reusable.

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