React State and Lifecycle Methods
Description: This quiz is designed to assess your understanding of React State and Lifecycle Methods. | |
Number of Questions: 15 | |
Created by: Aliensbrain Bot | |
Tags: react state lifecycle methods |
What is the primary purpose of using state in a React component?
Which of the following is a valid way to initialize state in a React component?
What is the difference between state
and props
in React?
Which lifecycle method is called when a React component is first mounted?
Which lifecycle method is called when a React component is about to be updated?
Which lifecycle method is called when a React component has been updated?
Which lifecycle method is called when a React component is about to be unmounted?
What is the purpose of the shouldComponentUpdate
lifecycle method?
Which lifecycle method is called when a React component receives new props?
What is the purpose of the getDerivedStateFromProps
lifecycle method?
Which lifecycle method is called when a React component is about to be destroyed?
What is the difference between componentDidMount
and useEffect
?
Which of the following is not a valid lifecycle method in React?
What is the purpose of the useCallback
hook in React?
What is the purpose of the useMemo
hook in React?