Skip to content
Advertisement

Tag: javascript

How make filter in sub component in reactjs?

The list doesn’t update after sorting in the parent component. console.log(‘sortedList’, sorted); – sort correctly ListFilter component: What is wrong? Answer The re-render is skipped because you have mutated state. It was mutated from within a child component making it even harder to catch. sort mutates the original array. As you can see in the examples from the docs, they

How do I make this with template string?

I have smth like this How do I make this the same but with using template string. It should be smth like this But it doesn’t work. Any help? Answer I think I miss understood you question any way check this solution Explanation : using [] instead of . when we call a property of an object when the property

How to get input from form using PHP/Jquery live?

I have a simple HTML form that includes an input field and a submit button. How can I use JQuery to get the text from the input field live and then send that data to a PHP file that evaluates the data? Form: Edit: here’s what I want it to look like Answer Your current code doesn’t need jquery to

Looking for an efficient way to animate toggle class

I have a CSS class that has left-margin: 150px and I just want to function it in an animated way. ToggleClass in jQuery works but without any animation. $(this).toggleClass(“active”, 1000, “easeInOutQuad”); I managed to do it animated using addClass and removeClass. But I am wondering if there is any easier way to do it. it takes 10 lines of code

how to get some data from one big array

I have a js file that has an array of people. data.js In another file, I want to get data from an array and form my array with name, gender data. I use the map, but I can’t figure out how to implement it. Answer Your data is an array so you will have to use its index.

MongoDb update with ElemMatch

I have a collection that has document structure like following: Mongo PlayGround As you can see, each document has basicDetails object and a tasks array. Each task contains some properties of its own and a subtasks array. I want to update subtasks’s description from ABC to XYZ where root level id is 1, task’id is 10 and subTasks.id =120 How

Regex – split string with delimiters into groups

It’s needed to parse strings like: object/custom/name1/name2 object/custom/name1/name2/typea object/custom/name1/name2/typea/item The result I’m expected to get is: group1: name1/name2 group2: typea group3: item Only group1 (the group with name) is required. Other groups (2,3) are optional. It depends on the string. E.g. for the first string should be present only first group with the string name1/name2. The string typea is static

Advertisement