What are the three lifecycle stages of the react lifecycle?
componentDidMount, componentDidUpdate, and componentWillUnmount
What is stateful logic?
It can be a function that handles a click event or maybe a function that sets toggle state, or even a function that formats data before it gets displayed. Usually, this logic deals with state in the component.
What is integration testing?
Which phase of the lifecycle is this: When the component is being build out from the ground up.
componentDidMount
How is non-visual behavior (stateful logic) applied usually?
Custom Hooks
What is end to end testing?
End-to-end testing is where the whole application is tested, simulating real user scenarios closely.
What happens in the growth/updating phase of the lifecycle?
In the componentDidUpdate phase, setState is set to update component data.
What is a custom hook?
Custom Hooks, are so-called because you are building the hook yourself (customizing it), to apply non-visual behavior and stateful logic throughout your components. This way, you can reuse the same hook over and over again.
What is Unit Testing?
When we test smaller units of software (often functions or methods) in isolation.
Which phase is considered the death of the lifecycle?
componentWillUnmount
True or False: Can a custom hook be used in place of useState? Example:
const CustomForm = () => {
const [username, setUsername, handleUsername] = useInput("");
}
True
We use _______ - _______ - library to run tests in this unit. Unlike previous testing libraries, this is designed with the user in mind, testing components via DOM nodes.
react-testing-library
What is missing in this class component?
class MyComponent extends React.Component {
constructor() {
________
this.state = {
arbitraryStateData: data,
}
}
}
super()
Freebie: What were the two custom hooks you used in your project this week?
useLocalStorage and useDarkMode
The ______ method renders a React element into a virtual DOM and returns utility functions for testing the component.
Hint: It's mentioned somewhere in this statement.
render