I’m trying to do an edit function, Where I’ll get the data from the backend. So if the value of dependents is ‘1,2’ then box the checkbox should be selected. I should be able to unselect the checkbox and send the value again if needed. In the below one, When we click on the add for the…
Tag: reactjs
How to change color of div that’s selected and others be same?
I have a dynamic array of divs representing numbered lists i.e. I have 2 classes, dot which is a gray color, active which is red. How can change the color of div to red which is clicked/selected and the rest be gray? Answer You use React, right? You could write a Component instead of your div that should cont…
Why does data from my api only display once and when I refresh the page it gives an error
Im working on a project that displays a random food title and the image of that food. Im having trouble figuring out why the data displays on the page only once and once I refresh the page, it gives an error of “Uncaught TypeError: recipeList.recipes is undefined”. This is my home.js and this is m…
React MUI: Matching the heights of two grid sections
Using MUI have two separate grids next to each other, both taking up 50% of a larger grid. As seen in the image below, I am having a hard time matching the heights of the two sections. I would like the smaller grid items (cards) to dynamically fill in the height of the left portion and match the height of
ReactJS. How to sort through data and find equal value of name property to id and store the object in a variable
I have a database and I am trying to sort through the data in the database and find the one that has a name property equal to the id variable that I specified. The id variable works though I am having trouble sorting through and finding the name property equal to the id variable. This what I have tried: I
Typescript: How do I define an interface for an object type’s key value pair
I have an object called externalObject that has various key:value pairs. I also have a typescript interface that is defined as the following: My question is how do I further set the type for the externalObject’s key as string and the values that are passed inside externalObject as string or number? Note…
three.js over cdn using svelte or react
Is there any way of building my svelte or react application in a way, that the three.js module (which I usually import using npm) will be declared as a script tag which will call the module from a CDN? I would like to keep the advantages of a framework but also be able to reduce my final bundle size, since
Comparing color strings in typescript
I am trying to compare the following color strings with each other, i am using localeCompare for this and here we have the following colors: ‘yellow’, ‘green’, ‘white’ and transparent. These are saved in the variable ‘status’ as shown below. How can i compare th…
Need to extract name value from json array of the output
I am unable to extract the name variable from the graph output of the following react code. trying to store the name value from the json output received from the api in my state variable in React. How do i do it? Answer Maybe because your checking the second console.log outside the callback. In javascript the…
Get new location and radius from Circle component in React Google Maps API
I’m using React Google Maps API package to create a map component with a circle component inside it. Here is the package from the npm registry https://www.npmjs.com/package/@react-google-maps/api. I’m using Circle component inside a Google Map component. I set the Circle to be draggable and resiza…