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

2.0.0-alpha.26 • Public • Published

@mediatr/react

Hooks

core

data

useCommand

import { useCommand } from '@mediatr/react'

export const App() {
  const myCommand = useCommand(MY_COMMAND, 'DEFAULT VALUE')
  
  if (myCommand.loading) {
    return (<p>loading</>)
  }

  return (
    <div>
      <p>{myCommand.data}</p>
      <button onClick={myCommand.handle}>handle</button>
    <div>
  )
}

useHandle

import { useHandle } from '@mediatr/react'

export const App() {
  const myCommand = useHandle(MY_COMMAND, 'PARAMS')
  
  if (myCommand.loading) {
    return (<p>loading</>)
  }

  return (
    <div>
      <p>{myCommand.data}</p>
      <button onClick={myCommand.handle}>handle</button>
    <div>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @mediatr/react

Weekly Downloads

3

Version

2.0.0-alpha.26

License

ISC

Unpacked Size

52.2 kB

Total Files

67

Last publish

Collaborators

  • allangomessl