Features
Fetch on mount and on key change

Fetch on mount and on key change

You can use useFetch to fetch a resource on mount and on key change.

useFetch(query) 

Example

function useHello() {
  const query = useSchema(getHelloSchema, [])
 
  useFetch(query)
  return query
}

Implementation

export function useFetch(query: Query) {
  const { fetch } = query
 
  useEffect(() => {
    fetch()
  }, [fetch])
}

See also