1.0.6 • Published 6 years ago

regraph-request v1.0.6

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

regraph-request

Simple React GraphQL requests

NPM

Install

npm install --save regraph-request

Usage

import React from 'react';
import PropTypes from 'prop-types';
import { Query } from 'regraph-request';

const QUERY = `
  query Test(
    $inputName: String
  ) {
    hello(name: $inputName)
  }
`;

export const HelloComponent = ({ data }) => {
  if (!data.hello) return <div />;
  return <div>{data.hello}</div>;
};

HelloComponent.propTypes = {
  username: PropTypes.string,
};

export const Hello = Query(HelloComponent, QUERY, props => ({
  inputName: props.username,
}));

export const App = () => {
  return (
    <RegraphRequest value="https://example.com/graphql">
      <Hello />
    </RegraphRequest>
  );
};

License

MIT © Altangent

1.0.6

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago