I have the following deceleration: const [open1, setOpen1] = useState(false); and would like to generate this as many as I fetch records from the database (for every record fetched ) I need new [open, setopen] here is my for loop used in my code. Answer Create separate component to hold ‘open’ sta…
Tag: javascript
Fix the upstream dependency conflict installing NPM packages
I am trying to npm install vue-mapbox mapbox-gl, and I’m getting a dependency tree error. I’m running Nuxt.js SSR with Vuetify and haven’t installed anything related to Mapbox prior to running this install and am getting this error. What’s the right way to go about fixing this upstream…
How to dynamically update Meta tags (OG) using JavaScript
This is my first question here in the Stack community. I know it has been asked earlier, but I wanted to know how to do it specifically just using JS (I’m not a coder by education). This is something what I am trying to do: I know the that’s not how to use tags, just to show you what I
Save a prop when moving away and coming back to page ReactJS
I have a username property that I have passed on from “log in” route to “product list” route using I then have a <Link to={‘/products/${product.id}’}>More info</Link> that sends me from “product list” to an “individual product”. When I th…
Discord: Get User by Id
I’m trying to create a web application to manage the users of my Discord server. In my database, I have stored only the users’ ids. I tried to use the discord.js API, but from what I’ve understood it requires a discord bot to do that. That’s not what I want. I would like to retrieve th…
Warning console : Each child in a list should have a unique “key” prop in table in code react.js
I want to correct the warning “Each child in a list should have a unique” key “prop” in the console. I tried adding the props “rowkey”, “key” in the but the problem still exists. Here is the warning on the console:: Answer You need to add ‘key’ prop …
position the translation of the English sentence on the right edge
I have an English sentence and its translation to an RTL sentence right below it: So far I can position the RTL sentence only at the very left or center of the English one. How can I position RTL sentence at the right edge of the English sentence like this: Answer grid and justify-content might help:
Select element only if it is immidiatly followed by another element
In JavaScript if I get all li elements with getElementsByTagName(“li”); how do I then only select li elements that are directly followed by span? For example: Here I want only to select 2nd li because it is followed by span immediately and not the first one because it opens with text. Answer the f…
Vue bindings and CSS in HTML does not work
I am trying to display vue within an HTML. It worked properly with the vue cli but now that I am trying to integrate it in a bare HTML file, CSS doesn’t work properly anymore. It might as well has to do with the bindings of vue since the shown bar should repeat three time, but is only shown once.
toggle (enable/disable) between two divs in user form
I’m new in JavaScript (not familiar yet with jquery) and I’m trying to insert some logic into my form. I want to be able to give the user the option to choose between two options (in my example: option_1 OR option_2) and soon the user insert some text to option_1 I want all sub-options in option_2…