Socket
Socket
Sign inDemoInstall

apollo-map-props

Package Overview
Dependencies
Maintainers
134
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-map-props - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

11

package.json
{
"name": "apollo-map-props",
"version": "1.3.0",
"version": "2.0.0",
"description": "To help with props mapping when using apollo with React",

@@ -22,2 +22,3 @@ "main": "build/index.js",

"devDependencies": {
"@apollo/client": "^3.1.3",
"babel-cli": "^6.24.1",

@@ -28,3 +29,2 @@ "babel-core": "^6.22.1",

"babel-loader": "^6.2.10",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-class-properties": "^6.23.0",

@@ -38,10 +38,9 @@ "babel-plugin-transform-object-rest-spread": "^6.23.0",

"babel-preset-stage-2": "^6.22.0",
"react": "^16.3.2",
"react-apollo": "^2.1.9"
"react": "^16.3.2"
},
"peerDependencies": {
"react": "^16.6.0",
"react-apollo": "^2.1.9"
"@apollo/client": "^3.1.3",
"react": "^16.6.0"
},
"dependencies": {}
}
import React from 'react';
import { ApolloConsumer } from 'react-apollo';
import { ApolloConsumer } from '@apollo/client';
export default function withClient(mapClientToProps) {
return WrappedComponent => {
const component = props => (
return (WrappedComponent) => {
const component = (props) => (
<ApolloConsumer>
{client => {
{(client) => {
const mappedProps = mapClientToProps(client, props);

@@ -15,7 +15,7 @@ return <WrappedComponent {...props} {...mappedProps} />;

component.displayName = `withClient(${WrappedComponent.displayName ||
WrappedComponent.name ||
'Component'})`;
component.displayName = `withClient(${
WrappedComponent.displayName || WrappedComponent.name || 'Component'
})`;
return React.memo(component);
};
}
import React from 'react';
import { Mutation } from 'react-apollo';
import { Mutation } from '@apollo/client/react/components';
import get from './get';
function getDisplayName(mapProps) {

@@ -16,4 +15,4 @@ const props = mapProps({});

const displayName = getDisplayName(mapProps);
return WrappedComponent => {
const component = props => (
return (WrappedComponent) => {
const component = (props) => (
<Mutation displayName={displayName} {...mapProps(props)}>

@@ -20,0 +19,0 @@ {(mutate, result) => {

import React from 'react';
import { Query } from 'react-apollo';
import { Query } from '@apollo/client/react/components';
import get from './get';

@@ -15,6 +15,6 @@

return WrappedComponent => {
const component = props => (
return (WrappedComponent) => {
const component = (props) => (
<Query fetchPolicy={config.fetchPolicy} {...mapProps(props)}>
{result => {
{(result) => {
const mappedProps = mapResultToProps(result, props);

@@ -31,4 +31,4 @@ return <WrappedComponent {...props} {...mappedProps} />;

withQuery.setConfig = newConfig => {
withQuery.setConfig = (newConfig) => {
config = { ...config, ...newConfig };
}
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc