Skip to content

Frog.castAction

Import

import { Frog } from 'frog'

Usage

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.

Read more.

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.

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.

Action Response

See the Cast Action Response API.