@workgrid/client-react
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

Workgrid Client React

Latest version

Installation

$ npm install @workgrid/client-react

Usage

import React from 'react'
import WorkgridClient from '@workgrid/client'
import { WorkgridProvider, useQuery } from '@workgrid/client-react'

const client = new WorkgridClient({ ... })

function Notifications({ location }) {
  const { data: notifications } = useQuery(['getNotifications', { location }])

  return (
    <ul>
      {notifications.map(notification => (
        <li key={notification.id}>
          ...
        </li>
      ))}
    </ul>
  )
}

function App() {
  return (
    <WorkgridProvider client={client}>
      <Notifications location="toknow" />
    </WorkgridProvider>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @workgrid/client-react

Weekly Downloads

6

Version

0.0.8

License

ISC

Unpacked Size

143 kB

Total Files

21

Last publish

Collaborators

  • workgrid-bot