Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 712 Bytes

README.md

File metadata and controls

42 lines (30 loc) · 712 Bytes

Hallow GRPC

Usage

import { Client } from "@hallow/grpc-web"
import { GreetingStub } from './greeting.proto'

// Setup
const client = new Client({ baseURL: "/api" })
const greeter = new GreetingStub(client)

// Promise
const res = await greeter.greeting()
console.log(JSON.stringify(res))

// React Hooks with Suspense
const hooks = greeter.createHooks()

function Greeter() {
    const res = hooks.useGreeting()
    return <div>{JSON.stringify(res.read())}</div>
}

function App() {
    return <Suspense fallback={'loading'}>
        <ErrorBoundary>
            <Greeter />
        </ErrorBoundary>
    </Suspense>
}

Dependency

  • google-protobuf
  • @improbable-eng/grpc-web

Setup

TBD