How to get the data from the queries

I have developed a plugin using react and it is coming up in my dashboard. but the problem is I have hardcoded the data.
now, how to get this data from the query (dAtasource)?
what should I write in place of this data:

this.state= {data: [
[ “A”, 100],
[“B”, 200]

the array length would increase depending on the query.
I tried with,
but that was returning the query.
Appreciate your help on this.