Imagine you have to log into the console a state variable, whenever the variable gets updated. What's the best place to perform such operation in a React component?
Before the return statement of the component
the useEffect hook
The
useEffecthook accepts...two callback functions
a callback function and an array
a callback function and an object
What is a pure React component?
A component that doesn't have any side effects
A component that has at least one side effect
What is the name of the second argument of the
useEffect()call?the dependency array
the callback function
the destructured object
the dependencies object
This code is incomplete:
React.useEffect(()=> { console.log('The value of the toggle variable is',toggle) }, [])You need to update the dependecies array so that the
useEffecthook is invoked whenever the toggle variable updates. Choose the correct solution from the choices below.The dependencies array should receive the toggle variable as its single member.
The dependencies array should be removed.
The dependencies array should be updated to: [{toggle}].
The dependencies array should be replaced with: {toggle}.

