How to use the react-apollo.connect function in react-apollo

To help you get started, we’ve selected a few react-apollo 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 tomitrescak / meteor-mantra-redux-graphql / src / client / modules / core / containers / post.ts View on Github external
}
});

const mapDispatchToProps = (dispatch: IDispatch, ownProps: IProps) => ({
  removePost: (mutation: any) => {
    dispatch(ownProps.removePost(ownProps.postId, mutation));
  },
});

const depsToPropsMapper = (context: IContext, actions: IActions) => ({
  removePost: actions.posts.remove
});

export default composeAll(
  compose(apolloContainer()),
  connect({ mapQueriesToProps, mapMutationsToProps, mapDispatchToProps }),
  useDeps(depsToPropsMapper) // -> not needed here
)(Post);
github tomitrescak / meteor-mantra-redux-graphql / imports / client / modules / core / containers / post.js View on Github external
removePostMutation: (id) => {
        return createMutation(`
      mutation removePost($id: String) {
         removePost(id: $id)
      }`, { id });
    }
});
const mapDispatchToProps = (dispatch, ownProps) => ({
    removePost: (mutation) => {
        dispatch(ownProps.removePost(ownProps.postId, mutation));
    },
});
const depsToPropsMapper = (context, actions) => ({
    removePost: actions.posts.remove
});
export default composeAll(compose(apolloContainer()), connect({ mapQueriesToProps, mapMutationsToProps, mapDispatchToProps }), useDeps(depsToPropsMapper) // -> not needed here
)(Post);
github tomitrescak / meteor-mantra-redux-graphql / src / client / modules / core / containers / newpost.ts View on Github external
// };

const mapStateToProps = (state: IState) => {
  return {
    error: state.post.error
  };
};

const mapDepsToProps = (context: IContext, actions: IActions) => {
  return {
     create: actions.posts.create
  };
};

export default composeAll<{}>(
  connect({mapMutationsToProps, mapStateToProps}),
  useDeps(mapDepsToProps)
)(NewPost);

// export default (NewPost);
github tomitrescak / meteor-mantra-redux-graphql / imports / client / modules / core / containers / postlist.js View on Github external
data: {
            query: gql `
          {
            posts {
             _id,
             title,
             content
           }
          }
        `,
            forceFetch: true
        }
    };
}
;
export default composeAll(compose(apolloContainer()), connect({ mapQueriesToProps }))(PostList);
github tomitrescak / meteor-mantra-redux-graphql / src / client / modules / comments / containers / comment_list.ts View on Github external
author
           }
          }
        `,
      forceFetch: true,
      variables: {
        postId: ownProps.postId
      }
    }
  };
};


export default composeAll(
  compose(apolloContainer()),
  connect({ mapQueriesToProps })
)(Component);
github tomitrescak / meteor-mantra-redux-graphql / src / client / modules / comments / containers / create_comment.ts View on Github external
};

const mapStateToProps = (state: IState) => {
  return {
    error: state.post.error
  };
};

export const mapDepsToProps = (context: IContext, actions: IActions ) => ({
  create: actions.comments.create,
  clearErrors: actions.general.clearErrors,
  context: () => context
});

export default composeAll(
  connect({mapMutationsToProps, mapStateToProps}),
  useDeps(mapDepsToProps)
)(Component);
github LeoLeBras / react-apollo-example / src / bundles / Wine / containers / WineContainer / connector.js View on Github external
export default function(
  container: React$Component
): () => React$Component {
  return compose(
    connect({
      mapQueriesToProps,
      mapMutationsToProps,
    }),
    withRouter
  )(container)
}
github tomitrescak / meteor-mantra-redux-graphql / imports / client / modules / comments / containers / create_comment.js View on Github external
}
            };
        }
    };
};
const mapStateToProps = (state) => {
    return {
        error: state.post.error
    };
};
export const mapDepsToProps = (context, actions) => ({
    create: actions.comments.create,
    clearErrors: actions.general.clearErrors,
    context: () => context
});
export default composeAll(connect({ mapMutationsToProps, mapStateToProps }), useDeps(mapDepsToProps))(Component);
github tomitrescak / meteor-mantra-redux-graphql / imports / client / modules / comments / containers / comment_list.js View on Github external
comments(postId: $postId) {
             _id,
             createdAt,
             text,
             author
           }
          }
        `,
            forceFetch: true,
            variables: {
                postId: ownProps.postId
            }
        }
    };
};
export default composeAll(compose(apolloContainer()), connect({ mapQueriesToProps }))(Component);
github LeoLeBras / react-apollo-example / src / bundles / Feed / containers / FeedContainer / connector.js View on Github external
export default (container: React$Element): React$Element => (
  compose(
    connect({
      mapQueriesToProps,
    }),
    withRouter
  )(container)
)