I have Switches created dynamically by a map like this: https://i.imgur.com/KuwY5Bb.png By this code: And it’s works but when I click one Switcher all switchers change together. This is happening because all Switches are created with the same “reference” enabled. How I set an individual var …
Tag: javascript
Mapping arrays into object with values as an array
I would like to create an object containing all the values from the array first and the values from second as an array of values, assuming that this key references multiple numbers such that given the arrays: This is what I have tried: This is what I get: Answer This is the easiest method to understand as it&…
How to separate Slack blocks into a separate file
I’m working on a slack bot in JS, and using Slack’s “block kit” to format the messages. However, quite often I get a function that looks like this: Most of the code is just formatting the block kit text, and it makes it difficult to navigate. Is there a common way to organize this code…
Filter array of infinitely nested objects
Let’s say I have an array of nested objects such as: And I would like to return a new array with id: 3 excluded for example. So it would become: The excluded id can be from any level, and it and its children should be removed. What’s the best approach to do this? I’ve tried several other sol…
Moving menu items into another div when window is resized?
How to create this type of table HTML with HTML, CSS, javascript. Answer
How do I add multiple tables without writing them 1 by 1
I try to find small real life problems and attempt to write code to make my life easier, one of them being a search-table simple program that sorts data based on user input. And my question is, is there a more efficient way to import data rather than having to write. like 1000 times? I would appreciate guidan…
How to style a React component with SCSS using props?
I created an UI library with several components. These components must not be changed in the frontend, and all their variations must be defined in the library, so they only need to pass props to the component. For the library I’m using React + Storybook + TypeScript + Rol lup. I don’t want to use …
JavaScript remove class from table rows
I have a table that highlight the tr (row) on click, and I can highlight multi rows on every click but I want to have only one row to be highlight in table. how to remove the highlight class from sibling rows. code below JavScript css Answer I ended up adding below code and issue resolved.
How can I show dynamic images with require() in React Native?
I’m fetching data from api and then i want to show images based on the symbol coming from the api data sending the path and the symbol to another component VVVV Is there a way to do it like that or i have to use something else ? Answer “In order for this to work, the image name in require
Not being able to print an array
i created empty array using the React State Hook, the array starts empty and i have 3 functions to (add to the array), (remove the last element of the array) and another to empty the array. The functions seems to work since i logged the result in the console. But when i want to print the array on a paragraph,