-
Why would you use class component over function components (removing hooks from the question)?
- Class components gives you different benefits over functional components such as
State
andLifecycle Hooks
- Class components gives you different benefits over functional components such as
-
Name three lifecycle methods and their purposes.
componentWillMount
: Your component is going to appear on the screen very shortly.shouldComponentUpdate
: Can be used to to stop a component from calling render if necessary.componentWillUnmount
: Can be used for any clean up you may need to do.
-
What is the purpose of a custom hook?
- Custom hooks are good for when you want to re-use the same logical & non-visual behavior for multiple inputs, events, etc.
-
Why is it important to test our apps?
- It's less expensive to fix things later on if we test our code from the very beginning.
- It encouragess us to write better code.
- It helps us consider edge cases.