# Knowledge check: Getting started with hooks - Advanced React

1. **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
        
    * <mark>the useEffect hook</mark>
        
2. **The** `useEffect` **hook accepts...**
    
    * two callback functions
        
    * <mark>a callback function and an array</mark>
        
    * a callback function and an object
        
3. **What is a pure React component?**
    
    * <mark>A component that doesn't have any side effects</mark>
        
    * A component that has at least one side effect
        
4. **What is the name of the second argument of the** `useEffect()` **call?**
    
    * <mark>the dependency array</mark>
        
    * the callback function
        
    * the destructured object
        
    * the dependencies object
        
5. **This code is incomplete:**
    
    ```javascript
    React.useEffect(()=> {
     console.log('The value of the toggle variable is',toggle)
    }, [])
    ```
    
    **You need to update the dependecies array so that the** `useEffect` **hook is invoked whenever the toggle variable updates. Choose the correct solution from the choices below.**
    
    * <mark>The dependencies array should receive the toggle variable as its single member.</mark>
        
    * The dependencies array should be removed.
        
    * The dependencies array should be updated to: \[{toggle}\].
        
    * The dependencies array should be replaced with: {toggle}.
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726466977800/b1a08131-3dd2-4f62-8062-1cc7169cb331.png align="center")
