You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					19 lines
				
				550 B
			
		
		
			
		
	
	
					19 lines
				
				550 B
			| 
											3 years ago
										 | 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> | ||
|  |   ) | ||
|  | } | ||
|  | ``` |