0.0.26 • Published 3 years ago

emitrpc-incept v0.0.26

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Emit RPC Incept JS Plugin

An Event RPC Incept plugin

Install

$ npm i emitrpc-incept

or

$ yarn add emitrpc-incept

Basics

In your package.json add emitrpc-incept like the following.

{
  "incept": [ "emitrpc-incept" ]
}

Next in a component use the hook useEmit() to call events remotely. There's no need to wrap this in useEffect().

import { useEmit } from 'emitrpc-react'

export default function About() {
  const response = useEmit('company-detail', { id: 1 })
  if (!response) {
    return <h1>Loading...</h1>
  }
  return <h1>About {response.results.name}</h1>
}

Resources