Testing & Best Practices Flashcards
1
Q
Which libraries are commonly used for testing React applications?
A
Jest and React Testing Library.
2
Q
How would you mock a module during testing in Jest?
A
Using jest.mock().
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.
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.