Last active
February 21, 2017 16:08
-
-
Save lassombra/616f5e1024093f539387f1fbc2fb709c to your computer and use it in GitHub Desktop.
To Decorate or not to Decorate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
"latest" | |
], | |
"plugins": [ | |
"transform-decorators-legacy", | |
"transform-class-properties" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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