Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
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);
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);
// };
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);
data: {
query: gql `
{
posts {
_id,
title,
content
}
}
`,
forceFetch: true
}
};
}
;
export default composeAll(compose(apolloContainer()), connect({ mapQueriesToProps }))(PostList);
author
}
}
`,
forceFetch: true,
variables: {
postId: ownProps.postId
}
}
};
};
export default composeAll(
compose(apolloContainer()),
connect({ mapQueriesToProps })
)(Component);
};
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);
export default function(
container: React$Component
): () => React$Component {
return compose(
connect({
mapQueriesToProps,
mapMutationsToProps,
}),
withRouter
)(container)
}
}
};
}
};
};
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);
comments(postId: $postId) {
_id,
createdAt,
text,
author
}
}
`,
forceFetch: true,
variables: {
postId: ownProps.postId
}
}
};
};
export default composeAll(compose(apolloContainer()), connect({ mapQueriesToProps }))(Component);
export default (container: React$Element): React$Element => (
compose(
connect({
mapQueriesToProps,
}),
withRouter
)(container)
)