Skip to content
Laviyx Learn

Try

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.

Intermediate 2 weeks 1 studentUpdated

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

JavaScript
{
  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. 1

    Set up the project

    Create a React app with Vite and plan the components: App, TransactionForm, TransactionList, Summary and Filters.

  2. 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. 3

    List, delete and edit

    Render with map and a stable key (the id). Delete with filter and edit with map.

  4. 4

    Derived values

    Calculate totals with reduce and the filtered list with filter during render. Do not store totals in state.

  5. 5

    Save to localStorage

    Load the saved list in the useState initialiser, and save it in a useEffect that runs when transactions change.

  6. 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.

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. push changes 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 transactions changes, 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

  1. Abstract: the problem, your solution and the result in one paragraph.
  2. Introduction and problem statement: who has the problem and why it matters.
  3. Requirements: the features (functional) and qualities such as speed and security (non-functional).
  4. Design: architecture diagram, database tables or data flow, and screen layouts.
  5. Implementation: the main modules and the most interesting code, explained.
  6. Testing: the test cases you ran, with inputs, expected and actual results.
  7. Results: screenshots or numbers that show the project working.
  8. 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.

All project ideas →