Answers for "component did mount mutation graphql"

0

component did mount mutation graphql

import React from 'react';
import { Mutation } from 'react-apollo';

class DoMutation extends React.Component {
  componentDidMount() {
    const { mutate } = this.props;
    mutate();
  };

  render() {
    return null;
  };
};

const MutationOnMount = ({ children, ...other }) => {
  return (
    <Mutation
      {...other}
    >
      {(mutate, { data, loading, error }) => (
        <React.Fragment>
          <DoMutation mutate={mutate} />
          { children && children(mutate, { data, loading, error }) }
        </React.Fragment>
      )}
    </Mutation>
  )
};


export default MutationOnMount;
Posted by: Guest on September-02-2020

Code answers related to "component did mount mutation graphql"

Code answers related to "Javascript"

Browse Popular Code Answers by Language