```tsx
import {AiChat, MessageReceivedCallback, MessageReceivedEventDetails, } from '@nlux/react';
import {useCallback} from 'react';

const messageReceivedCallback = useCallback<MessageReceivedCallback>((eventDetails: MessageReceivedEventDetails) => {
    console.log(eventDetails.message);
}, [/* Callback dependencies */]);
```

```tsx
// Provide the messageReceived callback as part of the events prop
<AiChat events={{messageReceived: messageReceivedCallback}} adapter={adapter} />
```
