How to use the relay-hooks.useRefetch function in relay-hooks

To help you get started, we’ve selected a few relay-hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github relay-tools / relay-hooks / examples / relay-hook-example / nextjs-ssr / components / TodoApp.tsx View on Github external
const AppTodo = (props: Props) => {
  const environment = useRelayEnvironment();
  const [{user}, refetch] = useRefetch(fragmentSpec, props.query);

  if (!user) {
    return <div>;
  }

  const handleTextInputSave = (text: string) =&gt; {
    AddTodoMutation.commit(environment, text, user);
    return;
  };

  const hasTodos = user.totalCount &gt; 0;
  console.log('renderer');
  return (
    
      <header>
      </header></div>
github relay-tools / relay-hooks / examples / relay-hook-example / todo / js / components / TodoApp.js View on Github external
const TodoApp = props =&gt; {
  const [user, refetch] = useRefetch(fragmentSpec, props.user);
  const [mutate, {loading}] = useMutation(mutation);
  const handleTextInputSave = (text: string) =&gt; {
    AddTodoMutation.commit(mutate, text, user);
    return;
  };

  const hasTodos = user.totalCount &gt; 0;

  return (
    <div>
      <section>
        <header>
          <h1>todos {props.userId}</h1>

          </header></section></div>