JSX runtime for composing Telegram messages.
# Using npm
npm install @grom.js/tgx
# Using jsr
deno add jsr:@grom/tgxThen in your tsconfig.json:
Usage with grammY:
import { html } from '@grom.js/tgx'
import { Bot } from 'grammy'
function Greeting(props: { name: string }) {
return <>Hello, <b>{props.name}</b>!</>
}
const bot = new Bot(/* TOKEN */)
bot.command('start', async (ctx) => {
await ctx.reply(
html(<Greeting name={ctx.from.first_name} />),
{ parse_mode: 'HTML' }
)
})
bot.start()
{ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "@grom.js/tgx" // "@grom/tgx" for jsr // ... } }