Giter VIP home page Giter VIP logo

cryptracker's Introduction

CrypTracker

CrypTracker is a single-page application (SPA) built with React that allows you to track your cryptocurrency transactions. It's like a personal assistant for your crypto portfolio, but without the snarky comments. It won't judge you for how much you've spent on Dogecoin. It just displays rather innocent stats.

Learning Objectives

This app was built as a learning project focusing on how state can be shared between components and how changes in one component can update the state and trigger re-rendering of other components.

Lifting State Up

The main component CryptoTransactionsApp manages the state of the entire application, including the cryptocurrency transactions data and the local storage retrieval and storage. This state is then passed down as props to child components such as CryptoList, Crypto, and Statistics to handle the display of the data.

Hooks

useState is used to manage the state of the entire application, including the list of transactions, the name of the currently selected cryptocurrency, and the error message when adding a new transaction.

useEffect is used to update the lastTransactionDates and totalTransactions props in the Statistics component whenever the transactions prop in the CryptoList component changes. It is also used to retrieve the transaction data from the localStorage whenever the component mounts or the transactions prop changes.

Components

CryptoTransactionsApp The CryptoTransactionsApp component manages the state of the entire application, including the cryptocurrency transactions data and the localStorage retrieval and storage. It passes down the necessary state and functions as props to the child components. By keeping the logic of the app in CryptoTransactionsApp, it allows the state management to be done at the highest level.

CryptoList The CryptoList component displays a list of all your cryptocurrencies and their transactions. It receives the transactions and deleteTransaction props from CryptoTransactionsApp. It also updates the lastTransactionDates and totalTransactions props in the Statistics component using the useEffect hook.

Crypto The Crypto component allows you to add and delete transactions for each cryptocurrency. It receives the name, transactions, addTransaction, and deleteTransaction props from CryptoList.

Statistics The Statistics component displays the last transaction date for each cryptocurrency and the total number of transactions. It receives the lastTransactionDates and totalTransactions props from CryptoList.

Footer No SPA is complete without one.

cryptracker's People

Contributors

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