►
From YouTube: Querying a Subgraph from a Web Application
Description
In this video, you'll learn how to query blockchain data from a subgraph in a JavaScript web application. While the library and approach covered in this video will allow you to query subgraphs from JavaScript web and mobile applications like React Native, the techniques and ideas covered in this video also apply to querying from Native iOS, Android, and Flutter mobile applications.
The Graph:
https://thegraph.com/
Code:
https://gist.github.com/dabit3/a4a0303a11e930465c591eec2f79167e
Sections:
0:00 Intro
0:25 Graph's QL Clients
0:42 API Lair
1:09 Querying a Subgraph
1:50 Getting started
A
In
this
video
you'll
learn
how
to
query
a
sub-graph
from
a
front-end
web
application,
while
what
we're
covering
will
show
you
how
to
query
web
as
well
as
javascript
mobile
applications
like
react,
native,
the
techniques
and
ideas
that
we'll
be
covering
can
also
be
applied
to
native
ios,
android
and
flutter
applications
as
well.
There
are
various
graphql
clients
available
in
the
ecosystem
and
I'll
be
going
over
two
of
them
today.
A
A
A
A
A
Now
we
can
open
the
project
in
our
text
editor
to
start
writing
some
code.
The
file
that
we'll
be
working
in
is
src
app.js,
we'll
first
import
create
client
from
ergo
which
will
allow
us
to
create
our
graphql
client
next,
we'll
import,
usefx
and
use
statehooks
from
react
to
manage
state,
as
well
as
to
call
lifecycle
methods.
A
A
A
A
A
A
To
do
so
we'll
create
a
tokens
array
in
the
local
state
using
use
state
setting
the
initial
value
as
an
empty
array
and
a
set
tokens
function
that
we
can
call
to
update
the
tokens
array
in
our
fetch
data
function.
We
can
now
call
set
tokens
passing
in
the
response.data.tokens
in
our
ui.
We
can
now
map
over
the.