Skip to content

Instantly share code, notes, and snippets.

@glortho
Last active July 21, 2017 21:24
Show Gist options
  • Save glortho/c4b5d11348f8335969622ff4503e98b6 to your computer and use it in GitHub Desktop.
Save glortho/c4b5d11348f8335969622ff4503e98b6 to your computer and use it in GitHub Desktop.
import React from 'react';
import { users } from './api_decorator';
@users
export default class RawApiExample extends React.Component {
handleClick = () => this.props.users.api.post( '/1/albums', {} )
render() {
return (
<div>
<button onClick={ this.handleClick }>FOO!</button>
<div>
{ this.props.users.api.$get( '/1/albums' ).map(({ data }) => (
<span key={ data.id }>{ data.title }</span>
))}
</div>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment