I am trying to create an React App with such that background-color will be set based on a prop. The App component maintains isDarkMode state which is a Boolean and is passed into the Header component and use it in styling the background-color of the Header Component via Styled components. Please see the codes…
Tag: javascript
Javascript recursion function including variables
I am trying to write a function where the function returns a sub-array of the name and age key/value pairs in the objects in an array. I am to use recursion to achieve it, however I can’t find a solution that doesn’t involve keeping the num and arr2 variables outside of the function (as when they …
react js : children style doesn’t show
I tried to create a component ‘Card’ and use it like a container. the code work well without ‘card’. when I tried to add it the ‘Card.css’ and expense-item in ExpenseItem.css doesn’t work this is ‘ExpenseItem.js’: this is ‘Card.js’: and this is…
How to access an element from an external HTML document?
I’m trying to build a small project where I create a new HTML document (which would be an individual page of an e-commerce product) and another document takes the information from that created document. However, I have no idea how to extract information from an external document without having to embed …
Converting PHP AES-256-CBC encryption into node.js
I have little to no knowledge in encryption and I’ve been facing issues trying to figure out how to convert these PHP functions to work with node.js and the crypto module. Any help would be much appreciated. Answer Actually, porting issues without target code are routinely closed on SO. But in this case…
jquery input doesnt accept numbers when set to case insensitive
i have this code that makes you search trought images without any problem, as this, it works case sensitive and i dont want that; to make it case insensitive i’d have to add an i here $(“img[alt*=” + val + ” i]”).show(); before the ]. now it is case insensitive but the problem is…
Datatables js: custom css
I’m using Datatables.js with Laravel. I’m post a request with ajax and I want to show the returned response in the table. Is there a way to customize this table? Can we customize the tags by giving them an id or class name? I tried this but didn’t get any results. For example: I want to make…
React hooks in dynamic lists – more hooks than previous render
Looking for an approach that allows me to use state hooks in dynamic lists of functional components. As my code stands a re-rendering of the list gives errors concerning changing numbers of hooks. I have a master component that renders a list of Functional components, the length of the list depends on the sta…
Uncaught TypeError: Cannot read properties of undefined (reading ‘toString’)
I am developing a React app and I don’t know how to solve this error. I’m pretty sure it’s from my useEffect function, but I can’t figure out what’s wrong. Any help would be much appreciated, thank you! Answer The problem isn’t in this part of the code. In error, you can se…
Apollo Client RetryLink has no headers in response
I’ve implemented a RetryLink into my Apollo Client as follows: The goal is to use a custom header sent by the server to adjust the delay (the server is rate limited). However, the headers field in the response is always empty. The response itself is present and looks as follows: If I use another link th…