Giter Site home page Giter Site logo

luiz504 / 03-ig22reactjs-dt-money Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 110 KB

Project developed following the lessons from the 3rd module of the ReactJS 2022 Bootcamp by Rocketseat.

Shell 0.30% HTML 2.68% TypeScript 97.03%
axios context phosphor-icons react react-hook-form styled-components typescript zod

03-ig22reactjs-dt-money's Introduction

DT Money

  This project was made following the Ignite Bootcamp 2022, Chapter 3, (API Consume and performance on React), promoted By Rocketseat®

Main Features:

  • Create Transaction
  • Show Transactions Summary
  • List Transactions
  • Search on Transactions List

Concepts to learn/revision about:

  • API consume
  • State management (locally, globally and scoped)
  • React Rendering understanding;
  • Performance monitoring
  • Performance improvements

Why a component re-renders

  • State, Context and Props changes
  • Force Update
  • Parent re-renders

Who React render flow works?

  1. React starts by calling the render method of the top-level component, which returns a tree of React elements.
  2. React then compares the new tree of elements with the previous tree to determine which parts of the UI need to be updated.
  3. If there are differences between the two trees, React updates the DOM to reflect the changes.
  4. During this process, React will call several lifecycle methods on the components involved in the update. These methods allow components to perform additional logic before or after rendering.
  5. After all the components have been updated, React will call the useEffect Hook to handle any side effects caused by the update.
  6. If the props or state of a component change, the entire process is repeated starting from step 1.
  7. If a component is unmounted, React will call the useEffect Hook with a cleanup function to perform any necessary cleanup before removing it from the DOM.

React.useCallback

  • It is a React Hook that is used to optimize performance by memoizing a function and preventing unnecessary re-renders of child components.
  • In general, you should use useCallback when passing down a function as a prop to a child component that may cause the child component to re-render unnecessarily.

    However, you should also be mindful of not overusing useCallback and only use it when necessary, as it can have a negative impact on performance if used excessively.

React.useMemo

  • It is a React Hook that is used to memoize a value or a computation and prevent unnecessary re-computations on re-renders.
  • Its usage follows the same aspects of React.useCallback

    Mind the overusage like React.useCallback.

React.memo

  • It is a higher-order component (HOC) provided by React that is used to optimize the performance of functional components by memoizing their output and preventing unnecessary re-renders.
  • When a functional component is re-rendered, React has to re-run the entire function and create a new virtual DOM tree, even if the props passed to the component haven't changed. This can be a performance bottleneck, especially for large or complex components.
  • You should use React.memo when you have a functional component that is expensive to render and receives the same props frequently, or when you want to prevent unnecessary re-renders of a child component.

    Its usage follows the same aspects of the previos Hooks described.

Instructions to run the Project

npm install
npm run dev:server
npm run dev

03-ig22reactjs-dt-money's People

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.