Skip to content

Category: Questions

how to restart a loop requestAnimationFrame

I’m tring to make a game and i want to use window.requestAnimationFrame() to make roles move, the movement seems to be right at first. but there is problem that when i re-trigger move() immediately after triggering pause(), the movement will be faster and faster, i have code blow, move()、pause() and ini…

How to use conditional rendering inside map in React

I have a react page that is rendering a list of products that are being returned from a GraphQL API. Once the products are returned, I’m storing them in a state and then render them. How do I only render products that meet certain conditions? Right now, I’m mapping over the products and rendering …

JavaScript, What have I done wrong? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 y…

Does loading a webextension’s background.js script impact performance, even if the script’s contents are minimal?

When installing a webextension, does the mere existence of a background.js file negatively impact performance* at all, considering that it is a separate javascript file that must be loaded? For most practical cases one could assume the answer is “pretty much No,” but in the case of an older comput…

Wait Until Data is Fetched from MongoDB React JS

I’m creating a Quiz App. This is the Quiz Page Code. Quiz DB Document contains a QuizQuestions Array which has question ids. Then I fetch specific question from MCQ/Question DB. Fetching MCQ takes time and when I console.log fetched data. First and second time data in undefined then its viewable. Due to…