Query a Datasource Directly from Panel Plugin React Code

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.

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

Would that work for your use case?