Get the id of the selected Datasource in the panel edit

What’s the proper way to getting the id (or name) of the datasource that is currently selected in the edit panel page?

If i extend props from PanelProps and then in my class call
getDataSourceSrv().get(this.props.data.request?.targets[0].datasource).then(res=>console.log(res.id))
i can get the id of it, but there’s probably a better way.
Does anyone know about it?

Not sure sure there is a better way, but if it is, I’d love to know as well :slight_smile: