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>
)
}
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>
)
}