In class components, I was able to do something like this: 

```js
this.setState({loading: true}, () => console.log('state updated'));
```

What is the equivalent in functional components using useState?