by rebotfc · 6y ago · 0 comments
For instance a simple custom hook use_graphql_list(url,query) can encapsulate the entirety of fetching json via a graphql query keeping an array up to date and in sync and present data in a format that is easy to use in a list component.
For instance in rust:
let graphql_query = "{countries {name currency emoji}}";
let graphql_url = "https://countries.trevorblades.com/";
let container_name = "countries";
let (list, graphql_control) =
use_graphql_list::<Country>(
graphql_query,
graphql_url,
container_name);No comments yet.