rah

react-axios-hooks-graphql-style

An axios wrapper

Showing:

Popularity

Downloads/wk

0

GitHub Stars

8

Maintenance

Last Commit

4mos ago

Contributors

0

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

Yes?

Categories

Readme

react-axios-hooks-graphql-style

A wrapper for axios to behave as graphql request

NPM JavaScript Style Guide

Install

npm install --save react-axios-hooks-graphql-style

Usage

useGet

Behaves like useQuery from graghql

import React, { Fragment } from 'react'

import { useGet } from 'react-axios-hooks-graphql-style'


const App = () => {
  const { loading, data, error } = useGet(
    'https://api.publicapis.org/entries',
    {}, // headers object
    (success: any) => {
      //TODO: Do something here
      console.log(success)
    },
    (error: any) => {
      //TODO: Do something here
      console.log(error)
    }
  )

  return (
    <Fragment>
      <div style={{ paddingLeft: 20 }}>
        {loading && <h3>Loading ...</h3>}
        {error && <h3>{error.message}</h3>}
        {data &&
          data?.entries.map((item: any) => (
            <div>
              <h3>API: {item?.API}</h3>
              <a href={item?.Link}>URL: {item?.Link}</a>
              <p>Description: {item?.Description}</p>
            </div>
          ))}
      </div>
    </Fragment>
  )
}

export default App

License

MIT © Mushud

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial