Mini project
Expense Tracker App in React
A React app to record income and expenses by category, see the balance and monthly totals, filter transactions, and keep data saved in the browser.
ReactViteJavaScriptlocalStorageCSS
The problem
Students and young professionals often do not know where their money goes each month. A simple tracker that is quick to use on a phone helps them see spending by category and plan a budget.
The project is a good way to practise React state, forms, lists and effects in one small, useful app.
Features to build
- Add a transaction with title, amount, type (income or expense), category and date
- Validate the form: amount must be a positive number and title is required
- List transactions newest first, with delete and edit
- Show total income, total expenses and balance, calculated from the list
- Filter by month and by category
- Category totals for the selected month
- Save transactions to localStorage so they stay after a refresh
Suggested data model
{
id: "c0a8…", // crypto.randomUUID()
title: "Groceries",
amount: 850, // a number, always positive
type: "expense", // "income" or "expense"
category: "Food",
date: "2026-11-28" // from <input type="date">
}Keep only the list in state. Totals and filtered lists are calculated from it during render.
Build plan
- 1
Set up the project
Create a React app with Vite and plan the components: App, TransactionForm, TransactionList, Summary and Filters.
- 2
State and the form
Keep the transactions array in App with useState. Build a controlled form and add a new transaction with the spread operator, never by changing the old array.
- 3
List, delete and edit
Render with map and a stable key (the id). Delete with filter and edit with map.
- 4
Derived values
Calculate totals with reduce and the filtered list with filter during render. Do not store totals in state.
- 5
Save to localStorage
Load the saved list in the useState initialiser, and save it in a useEffect that runs when transactions change.
- 6
Style, test and publish
Make it work on a phone screen, test empty and invalid inputs, and deploy the built app on GitHub Pages or a free host.
Learn these first
Each part of the project is taught in one of these free lessons.
- React Components: Function Components Explained
- React useState Hook: State Explained with Examples
- React Forms: Controlled Inputs, Validation and Submit
- Rendering Lists in React with map() and Keys
- Updating Objects and Arrays in React State (Immutability)
- Lifting State Up in React: Sharing State Between Components
- React useEffect Hook Explained: Dependencies and Cleanup
- localStorage and sessionStorage in JavaScript: Saving Data in the Browser
Make it stand out
- A monthly budget per category with a warning when it is exceeded
- A chart of spending by category
- Export and import transactions as a CSV file
- A backend with Node.js and a database, with login, so data works across devices
Viva and interview questions
Try to answer each one aloud before you open it.
Why do you not store the balance in state?
The balance can be calculated from the transactions. Storing it separately means two values must be kept in sync, and a bug could make them disagree. Calculating it during render keeps one source of truth.
Why do you create a new array instead of using push?
React compares state by reference.
pushchanges the same array, so React may not see a change. Creating a new array with the spread operator tells React the state changed and it re-renders.Why does each list item need a key?
Keys let React match items between renders, so it updates, adds or removes only the right rows. The id works well because it never changes. The array index can cause bugs when items are deleted.
When does your useEffect run?
After the first render and again whenever
transactionschanges, because it is in the dependency array. It saves the latest list to localStorage.What are the limits of localStorage for this app?
It only works on one browser on one device, holds a few megabytes, and the user can clear it. For data across devices you need a backend with a database.
What to put in your project report
- Abstract: the problem, your solution and the result in one paragraph.
- Introduction and problem statement: who has the problem and why it matters.
- Requirements: the features (functional) and qualities such as speed and security (non-functional).
- Design: architecture diagram, database tables or data flow, and screen layouts.
- Implementation: the main modules and the most interesting code, explained.
- Testing: the test cases you ran, with inputs, expected and actual results.
- Results: screenshots or numbers that show the project working.
- Conclusion and future scope: what you achieved and what you would add next.
Your college may give its own format. Follow that first, and use this list to check nothing is missing.
More project ideas
- Quiz App with HTML, CSS and JavaScriptMini project
- Snake Game with JavaScript and CanvasMini project
- Typing Speed Test with JavaScriptMini project