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 10 …
Deep find object in tree, then return object and the path to it through the tree
I’ve written a recursive function to find a given object and the path within that tree, but when I change the target id (over here : if(tree.targetModuleId === 7)) to 10 I got error: “message”: “Uncaught TypeError: Cannot read properties of undefined (reading ‘unshift’)R…
Javascript classList.add to element with 0px height
Not sure if I’m missing something obvious here, but I’m trying to add a class to an element that has 0px height to begin with. On click, the class .show is added and the .hidden class is removed. But it doesn’t work if the .hidden class has 0px assigned to it. Answer The problem is that if y…
JS How can I increase the performance of this Max/Min coding challenge?
I’m trying to solve some ‘hackerrank.com’ coding challenges. I’m stuck on this one: You will be given an array of integers arr and a single integer k. You must create an array arr’ of length k from elements of arr such that its unfairness is minimized. Unfairness is defined as ma…
Is eslint pre-commit hook in CRA bootstrapped application required?
My react application is bootstrapped using CRA(react-scripts v4.0.0) and I want to add a code formatter (prettier to be specific) that must format the code before committing the changes to my git repo. I know that eslint is a dependency of react-scripts and linting is done using ‘eslint-webpack-plugin'(…
How to hide radar chart index labels (chart.js)
I’m trying to make a radar chart with a dark background. White index labels distract from the chart itself. (my chart) I found a thread that raised a question about customizing index labels, but the code in the answer only works with version 2.1.3 or mb close to it. Is it possible in chart.js@3.5.1? Ans…
Adding value to an array in useState but only at a particular index of the array
I have a piece of state which holds an array of comments. Each comment has an array of replies. How can I add a reply value to the replies array of a specific comment within the comments array? Here is my current attempt: idx holds the correct value I need but I do not think my implementation is correct here.
create image in React from backend dataURL
I’m trying to get a snapshot of HTML canvas like so: which seems to be working, and connected properly to the database. But I can’t figure out how to use the dataURL to create an image component on the React frontend I’m able to fetch them from the backend just fine and log the dataURL. I gu…
My Javascript file won’t run because of bigint error
I am trying to use @metaplex/js to do some NFT minting. Usually my .js files work properly but when I run the file this error comes up. bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?) I don’t really get what that means. So, I tried to run npm run rebuild but rebuild is said
Different function gets passed to useEffect on every render? – ReactJS useEffect
I was going through useEffect from reactjs docs and I’ve found this statement here Experienced JavaScript developers might notice that the function passed to useEffect is going to be different on every render. We are passing a function to useEffect and this function is said to be different for each rend…