Skip to content

Commit

Permalink
Merge pull request #1 from detrohutt/patch-1
Browse files Browse the repository at this point in the history
Remove duplicated section from README.md
  • Loading branch information
pierrecabriere authored Mar 15, 2018
2 parents e99e5c2 + 7be5471 commit 9f55283
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,36 +323,6 @@ export default withGuard('logged', 'loggedAdmin')(MyComponentForLoggedAdminUsers

### 7.1 - Use decorators

Instead of wrapping the export of your Component inside HOCs, a good usage is to use ES6 decorators. To do such a thing, you have to use the *transform-decorators-legacy* babel plugin :
```
npm install --save-dev babel-plugin-transform-decorators-legacy
```

create or edit a .babelrc file at the root of your project
```diff
{
"presets": "next/babel",
"plugins": [
+ "babel-plugin-inline-import-graphql-ast"
]
}
```

You can now use ES6 decorators in your project :
```jsx
import { withData } from '../lib/next-apollo-hoc'

@withData
@graphql(myQuery)
export default class extends React.Component {
render() => (
<div>Component that will load data from a graphql endpoint</div>
)
}
```

### 7.1 - Use decorators

Instead of wrapping the export of your Component inside HOCs, you can use ES6 decorators. To do such a thing, you have to use the *transform-decorators-legacy* babel plugin :
```
npm install --save-dev babel-plugin-transform-decorators-legacy
Expand Down

0 comments on commit 9f55283

Please sign in to comment.