I’m using an esp32 microcontroller for my web server backend. I use a template processor function to build the page on the backend because i can’t use more then 8 socket connection because the MCU will crash. In order to load my page faster, i try to save a relatively huge language JSON file on th…
Filtering data after fetching in React
I need to make a list of objects based on combined data from 2 arrays, one comes from a localStorage and the second one from Django backend. First of all objects from localStorage are displayed by showCart() function it returns data in this format: FE: { id: 1, amount: 7, size: “L”, product: 1 }. …
How to call useMap() outside of the file where is NOT called?
I am using react-leaflet. For example I want to set bounds to map outside of the file where <MapContainer> is called. For this I need to use const map = useMap();. How do I connect useMap() with the file where was called? Or to clarify even more.. I want to connect with the map outside of the map file t…
Passing string to Bootstrap Modal using Javascript
Learning Javascript and trying to learn how to pass values. In this example, I have a where a user types a message, for example, and that string is stored and displayed in a Bootstrap Modal. The problem…the last character is cut off unless you press return or spacebar. I have tried adding an empty space…
build array of object from tree object
I’m trying to get into javascript’s built-in reduce function and with the help of that build objects inside array. But you can use whatever function or method you want. Expected output What I tried to do I created a function which takes array as an argument and calls reduce for each array’s …
Repeated if else blocks
I have an if else construction that will sound absurd to you. Actually, I wrote a basic version of my real code so as not to prolong it. Is there anyone who can rationalize it? Answer You can use some early returns after finding a case for updating the data: You can avoid the early returns by putting the data
How to Append a table with specified data from Google Spreadsheet to Google Doc using Google App Script? [duplicate]
This question already has answers here: How do I insert an array into a Google Doc using data from Google Sheets? (2 answers) Closed 4 months ago. As title, I’ve tried to append a table to Google Docs from Google Spreadsheet using GAS. So far, the post and some scripts I can find is about appending the …
useState react error Too many re-renders mergin state props input
I am having problems with updating state by mergin selected input props in one string in order to pass a proper path with values to API. I have something like this in logic : The purpose of the code is to get two strings values from the form component (I am using Formik) and this actually works just fine. But
Append to array in async for loop
I’ve got this function which contains other nested async functions. I’m unzipping a zipfile and then appending each HTMLImageElement to an array. However, the array is printing like this 16 is the correct number of images I’m expecting, but they’re undefined when I console.log() them. …
React text dropdown toggle (toggles all)
I am trying to make a small text dropdown. When you click on the heading text, the p tag will show. It is working, but.. it is toggling all of them, when I only click on of them. I have multiple “li” tags with text and the function. So I am not looping anything Answer Based on your question and