# Self-review: Managing state within a component - Advanced React

1. **Is this a valid** `useState` **hook invocation and destructuring?**
    
    ```javascript
    const [car, setCar] = useState({ color: 'blue', mileage: 0})
    ```
    
    * <mark>Yes</mark>
        
    * No
        
    * It would be valid, if it was spread over multiple lines.
        
2. **True or False: You can clone a JS object using the . operator (the dot operator).**
    
    * True
        
    * <mark>False</mark>
        
3. **Consider the following code:**
    
    ```javascript
    const [person, setPerson] = useState({ name: 'John', age: 21})
    ```
    
    **Imagine you're using a** `setPerson()` **state-updating function to update the value of the state variable named person. You only want to update the value of age, from 21 to 22. Choose the correct code snippet to do that.**
    
    * <mark>setPerson(prev =&gt; ({ ...prev, age: 22 }));</mark>
        
    * setPerson(() =&gt; ({ age: 22 }));
        
    * setPerson(person.age = 22);
        

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726462570492/e2f25b16-32d0-4ad9-8c40-1aaef77f0385.png align="center")
