apollo-map-props
Advanced tools
Comparing version 1.3.0 to 2.0.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15
10595
10
77
1