Skip to content

Instantly share code, notes, and snippets.

@lassombra
Last active February 21, 2017 16:08
Show Gist options
  • Save lassombra/616f5e1024093f539387f1fbc2fb709c to your computer and use it in GitHub Desktop.
Save lassombra/616f5e1024093f539387f1fbc2fb709c to your computer and use it in GitHub Desktop.
To Decorate or not to Decorate
{
"presets": [
"latest"
],
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
]
}
import React from 'react';
import {graphql} from 'apollo-react';
import {gql} from 'graphql-tag';
@graphql(gql`query{toDos{id}}`)
export default class Component extends React.Component {
render() {
return <div></div>;
}
}
import React from 'react';
import {graphql} from 'apollo-react';
import {gql} from 'graphql-tag';
import { connect } from 'react-redux';
@graphql(gql`query{toDos{id}}`)
@connect(state => ({}))
export default class Component extends React.Component {
render() {
return <div></div>;
}
}
import React from 'react';
import {graphql} from 'apollo-react';
import {gql} from 'graphql-tag';
class Component extends React.Component {
render() {
return <div></div>;
}
}
const apolloAwareComponent = graphql(gql`query{toDos{id}}`)(Component);
export default apolloAwareComponent;
import React from 'react';
import {graphql} from 'apollo-react';
import { connect } from 'react-redux';
import {gql} from 'graphql-tag';
class Component extends React.Component {
render() {
return <div></div>;
}
}
const reduxAwareComponent = connect(state => ({}))(Component);
const apolloAwareComponent = graphql(gql`query{toDos{id}}`)(reduxAwareComponent);
export default apolloAwareComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment