Query a Datasource Directly from Panel Plugin React Code

Hello,
I’m developing a Panel Plugin and I need to make some real-time generated queries directly from the code. Is there a way to accomplish that?
I know there is a way in Angular but I can’t figure out how to do that in React.
Thanks.

This answer suggests that you can access the data source instance using the getDatasourceSrv:

Would that work for your use case?