File size: 550 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
The hook which allows you to use {@link ActionJSON} to perform actual actions on the backend.
Base on the action type and parameters (like {@link 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>
)
}
``` |