adminjs
Version:
Admin panel for apps written in node.js
19 lines (15 loc) • 550 B
Markdown
The hook which allows you to use {actual actions on the backend.
Base on the action type and parameters (like { ActionJSON.guard}) it behaves differently.
### Usage
```javascript
import { useAction } from 'adminjs'
import { Button } from '@adminjs/design-system'
const myComponent = ({ action }) => {
const { href, handleClick } = useAction(action, {
resourceId, recordId, recordIds,
}, actionPerformed)
return (
<Button as="a" onClick={handleClick} href={href}>Click this action</Button>
)
}
```
ActionJSON} to perform