• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
willemhelmet

willemhelmet

tip-calculator

Remix of jxnblk/react-router-hono-starter
Public
Like
tip-calculator
Home
Code
7
.vtignore
AGENTS.md
README.md
client.tsx
deno.json
routes.tsx
H
server.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
server.tsx
https://willemhelmet--0199baf57885766a9103dff131baa474.web.val.run
README.md

Tip Calculator

A simple and interactive tip calculator application that helps you split bills among friends and colleagues with ease.

Features

  • Bill Amount: Enter the total bill amount.
  • Number of Guests: Specify how many people are splitting the bill.
  • Tip Percentage:
    • Choose from preset options: 15%, 18%, 20%.
    • Use the slider for a custom tip percentage (from 0% to 30%).
  • Real-time Results:
    • Displays the calculated tip amount.
    • Shows the total bill including the tip.
    • Calculates and displays the amount each person should pay.

How to Use

  1. Enter the total bill amount in the "Total Bill Amount" field.
  2. Enter the number of guests in the "Number of Guests" field.
  3. Select a tip percentage by clicking one of the preset buttons (15%, 18%, 20%) or by using the slider to choose a custom percentage.
  4. The results will automatically update at the bottom of the page, showing the tip amount, the total amount with the tip, and how much each person should pay.

Technologies Used

  • React: For building the user interface.
  • React Router: For routing and navigation.
  • Hono: For the server-side framework.
  • Deno: As the JavaScript/TypeScript runtime.
  • Server-Side Rendering (SSR): The application is rendered on the server for a fast initial load and then hydrated on the client for interactivity.

File Structure

.
├── client.tsx
├── deno.json
├── README.md
├── routes.tsx
└── server.tsx
  • server.tsx: Sets up the Hono server, handles server-side rendering of the React application, and serves the client-side JavaScript.
  • client.tsx: Hydrates the server-rendered HTML on the client-side to make the application interactive.
  • routes.tsx: Defines the application's routes and contains the main Home component with the tip calculator's logic and UI.
  • deno.json: Configuration file for the Deno runtime.

How It Works

This application is built using a modern web stack that leverages server-side rendering (SSR) for optimal performance.

  1. Server-Side Rendering: When you first visit the application, the server.tsx file (which uses the Hono framework) renders the initial HTML on the server. This HTML is sent to your browser, allowing you to see the page content immediately.
  2. Client-Side Hydration: The client.tsx file is then loaded by the browser. It "hydrates" the server-rendered HTML, which means it attaches the necessary JavaScript event listeners and makes the page interactive. This allows the tip calculator to respond to your input in real-time without needing to reload the page.
  3. React Components: The user interface is built with React components defined in routes.tsx. The Home component manages the state of the bill amount, number of guests, and tip percentage, and it performs the calculations whenever these values change.
HTTP
  • server.tsx
    willemhelmet--01…74.web.val.run
Code
.vtignoreAGENTS.mdREADME.mdclient.tsxdeno.jsonroutes.tsx
H
server.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.