Coder Social home page Coder Social logo

piyush-eon / frontend-interview-questions Goto Github PK

View Code? Open in Web Editor NEW
295.0 4.0 225.0 1.18 MB

Frontend Interview Questions from My Youtube Videos

Home Page: https://www.youtube.com/roadsidecoder

HTML 17.80% CSS 13.06% JavaScript 69.14%
dsa interview-questions javascript js react reactjs

frontend-interview-questions's Introduction

frontend-interview-questions's People

Contributors

piyush-eon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

frontend-interview-questions's Issues

Unexpected behavior without useCallback hook

if (isMouseDown) {
const startBox = selectedBoxes[0];
const endBox = boxNumber;

  const startRow = Math.floor((startBox - 1) / cols);
  const startCol = (startBox - 1) % cols;

  const endRow = Math.floor((endBox - 1) / cols);
  const endCol = (endBox - 1) % cols;

  const minRow = Math.min(startRow, endRow);
  const maxRow = Math.max(startRow, endRow);
  const minCol = Math.min(startCol, endCol);
  const maxCol = Math.max(startCol, endCol);

  const selected = []; // BUG
  const selected = [startBox]; // FIX

  for (let row = minRow; row <= maxRow; row++) {
    for (let col = minCol; col <= maxCol; col++) {
      selected.push(row * cols + col + 1);
    }
  }
  console.log(selected);
  setSelectedBoxes(selected);
}

There is a bug in the code, as we are loosing the initial coordinate of the selected part, when we are re-calculating it. It is avoided when we use the callBack hook because it is not calculated when selected box changes, as we have only given the parameter as mouseDown. 

I thought of opening a PR, but i guess it's too minor of an issue, so i mentioned the fix in the issue itself. 

Great tutorial!

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.