Code Monkey home page Code Monkey logo

budget-manager-app-react's Introduction

In this task, you will be building a Budget Manager App that helps users manage their budgets and expenses. The app consists of two main components, BudgetForm and ExpenseForm, which are used to add budgets and expenses, respectively.

Let's go through the functionality of each component in detail.

BudgetForm Component:

  • The BudgetForm component is responsible for adding budgets to the app. It has two input fields, one for the budget name and another for the budget amount.
  • When the form is submitted, a handleSubmit function should be called, which prevents the default form submission behavior, extracts the name and amount from the input fields using useState hooks, and then add the name and amount of the budget to budgets array.
  • After submitting the form, the input fields should reset to empty values.

ExpenseForm Component:

  • The ExpenseForm component is responsible for adding expenses to the app. It has three input fields, one for the expense name, another for the expense amount, and a select field for selecting the budget category.
  • The categories are populated in the select field using the budgets array received as props from the parent App component.
  • When the form is submitted, an onSubmit function should be called, which prevents the default form submission behavior, extracts the name, amount, and categoryId (selected budget category) from the input fields using useState hooks, and then add the name, amount, and categoryID to expenses array.
  • After submitting the form, the input fields should reset to empty values.

App Component:

  • The App component is the main component that renders the BudgetForm and ExpenseForm components.
  • It also maintains the state for budgets and expenses using useState hooks.
  • The budgets state is an array that holds the list of budgets added by the user, and the expenses state is an array that holds the list of expenses added by the user.
  • The getCategoryName function is a utility function defined in the parent App component. It takes a categoryId as an argument and finds the corresponding budget category from the budgets array.

Note: 
Do not remove the given boilerplate.
Do not remove the classes and Ids from the boilerplate.
Use Date.now() as categoryId.

budget-manager-app-react's People

Contributors

manpreet-01 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.