grater-react
v0.1.3
Published
React components to interact with Grater.io
Downloads
1
Readme
grater-react
is a set of React components to interact with Grater.io.
Getting Started
yarn add grater-react
Demo
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 ~