react-hasura-resource
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

NPM Version Package License NPM Downloads Minified Size Minzipped Size

Description

React Hasura Resource

Installation

$ yarn add react-hasura-resource

Example

import { ReactHasuraResourceContext } from 'react-hasura-resource';
 
const hasuraResourceConfig: HasuraResourceContextState = {
  endpoint: 'https://react-hasura-resource-data.herokuapp.com',
  config: {
    primaryKey: {}
  }
}
 
const App = () => (
  <HasuraResourceContext.Provider value={hasuraResourceConfig}>
    <HasuraResourceList
      tableName="student"
      render={({ data, status }) => (
        status === 'success' ? (
          <ul>
            {data?.map(student => (
              <li key={student.id}>{student.name}</li>
            ))}
          </ul>
        ) : (
          <p>Loading...</p>
        )
      )}
    />
  </HasuraResourceContext.Provider>
)

Readme

Keywords

none

Package Sidebar

Install

npm i react-hasura-resource

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

166 kB

Total Files

33

Last publish

Collaborators

  • n3n