Giter Site home page Giter Site logo

defacto-clone's Introduction

Defacto Clone

Team Leader

  • Fatma yasser

Team Members

  • Mariam
  • Anas
  • Abanoub
  • Daghash
  • Doha
  • Abdallah

1. Todo

Pages

  • Home Page (Abdallah / Anas)
  • Women Page (Anas)
  • Men Page (Anas)
  • kids Page (Anas)
  • Products Page
  • Product Page (Anas)
  • Favorites Page (Doha)
  • Help Page
  • Admin Page
  • Stores Page (Doha)
  • Shoppign cart page

Components

  • Header (Abanoub / Anas)
  • Footer (Daghash / Anas)
  • Image Slider (Anas)
  • Trends (Anas)
  • Collections (Doha)
  • Shopping Cart dropdown (Anas)
  • items in cart (Abdallah)
  • Sidebar Filters
  • Register (Mariam)
  • Login (Mariam)
  • Products View Images (Abdallah / Anas)
  • collections
  • appreals
  • accessories

Adding Functionality

  • [ ]

Data Collecting

  • collecting the data from zappos api (Anas)
  • collecting data from decota website (Abanoub)

problems

  • problem1
  • loading the items from local storage using useEffect to the react state to retrieve lost data after refreshing
const [cart, setCart] = useState([]);
  useEffect(() => {
    if (!isGuest) {
      setCart(getUserItems);
      //setCart get data from local storage
    }
  }, []);

the page and at the same time using useEffect to change the localStorage data after the state changes:

  useEffect(() => {
    console.log("cart changed");
    if (!isGuest()) {
      updateLocalStorage("cart", cart);
    }
  }, [cart]);

which causes conflict because the useEffect runs asychronously and when the page refreash the state changes to its intial value so the somtimes the localStorage is cleared

solution

instead if changing intializing the state with [] and waiting and changing it with localstorage data after refresh just intialize it with localstorage data

const [cart, setCart] = useState(() => {
   return !isGuest() ? getUserItems("cart") : [];
 });

problem2 random numbers used in creating items changes after each reload making solution using seeded random number using (seedrandom.js)

defacto-clone's People

Contributors

anasmustafa123 avatar dohamohamed-90876 avatar don085 avatar hkpro14 avatar mariam2412 avatar tmtm8976 avatar walaa-gaber 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.