grater-react

0.1.3 • Public • Published

grater-react is a set of React components to interact with Grater.io.

Getting Started

yarn add grater-react

Demo

On the interweb

In the javascripts

Usage

It couldn't be easier to get up and running with your data from Grater.

In your React app:

import { DataFetcher } from 'grater-react'
 
 
const ExampleComponent = () => (
  <DataFetcher
    apiHost="<API_HOST>"
    canonicalName="<YOUR_ENDPOINT>"
    accessToken="<ACCESS_TOKEN_FOR_PRIVATE_ENDPOINTS>"
  >
    {({ data, error, loading }) => {
      if (loading) {
      
        // Fetching the data
        return <h1>Loading data...</h1>
        
      } else if (error) {
      
        // Error fetching data
        return <h1>There was an error...</h1>
        
      } else {
      
        // Successfully retrieved data
        return <h1>Do something with the data...</h1>
        
      }
    }}
  </DataFetcher>
)
 
  
export default ExampleComponent

~ your friends at Grater ~

Readme

Keywords

none

Package Sidebar

Install

npm i grater-react

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

35.8 kB

Total Files

16

Last publish

Collaborators

  • mjmasia