Frog.castAction
Import
import { Frog } from 'frog'
Usage
/** @jsxImportSource frog/jsx */
// ---cut---
import { Button, Frog } from 'frog'
const app = new Frog()
app.castAction('/', (c) => {
console.log('Apple and Banana')
return c.res({ message: 'Action Succeeded' })
})
Parameters
path
- Type:
string
Path of the route.
/** @jsxImportSource frog/jsx */
// ---cut---
import { Button, Frog } from 'frog'
const app = new Frog()
app.castAction(
'/foo/bar',
(c) => {
console.log('Apple and Banana')
return c.res({ message: 'Action Succeeded' })
}
)
handler
- Type:
(c: Context) => CastActionResponse
Handler function for the route.
/** @jsxImportSource frog/jsx */
// ---cut---
import { Button, Frog } from 'frog'
const app = new Frog()
app.castAction(
'/foo/bar',
(c) => {
console.log('Apple and Banana')
return c.res({ message: 'Action Succeeded' })
}
)
Context Parameter
See the Cast Action Context API.