Skip to content

Category: Questions

How to pass index to child function

Here is the question. I want to pass index of each child element to the function handleChange, but I can’t get it))) When I click on TabPanelItem appears error handleChange is not a function What’s the problem? Parent Element: and my child component: Answer you made a mistake in this line you dont…

Memoize a recursive Fibonacci function

I created a withMemo function that returns a memoized version of the provided function. How can I memoize this fibonacci function that works with recursion ? Indeed withMemo(fibo) doesn’t improve performance since the recursive calls inside fibo still point to the unmemoized version… So I have to …

Angular – function in ngFor called multiple times

I have a template: Component and service: I want to fetch the list of trucks in my template based on a parameter cargo.id. I’m getting data from backend but the function getTrucksByUserIdAndRules(cargo.id) is called multiple times. I know this is not a good practise to use functions inside template and …

mongodb collection uuid how to update?

How to create collection in mongodb with specific uuid or update the uuid ? Adding details: When I create a collection mongodb generate automatically uuid and if this is replicaSet the uuid is replicated to all SECONDARY members via the oplog: But I would like to know if there is an option this UUID to be cre…

Show GIF and text, only when button is clicked

When I click the button the image does not show up along with the text, this is what I have tried so far: Answer 1) TYPO: There is no method as getElementByClassName, instead it is getElementsByClassName. 2) getElementsByClassName will return an array-like data structure, so you have to fetch the HTML element…

How to get all the favicon from the site, by url

Here is my parser: It returns an array of URLs, with all URL favicons. How can the user get these favicons? when entering the URL in the input and get the favicons. Like google labels, we enter the URL and get the labels with the favicon How can I do the same thing? Answer I hope this example would help: