Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

"QueryRenderer" #12

Open
fakenickels opened this issue Nov 27, 2020 · 0 comments
Open

"QueryRenderer" #12

fakenickels opened this issue Nov 27, 2020 · 0 comments

Comments

@fakenickels
Copy link
Member

[@react.component]
let make =
    (
      ~state: AsyncHook.state('a, 'e),
      ~refetch,
      ~renderLoader=() => <FullLoader />,
      ~children,
      (),
    ) => {
  switch (state) {
  // TODO figure out what to do better with Idle state
  | Idle
  | Loading => renderLoader()
  | Error(error) => <Oopsie error={Oopsie.convertError(error)} refetch />
  | Data(data) => children(data)
  };
};
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant