Skip to content

Tag: reactjs

How to iterate over all children elements?

How to iterate over all children elements? I have an array that has an infinite number of nested childrens, how do I output all of them? I only go through two levels, but there can be as many as you like. Answer Make the mapper a named function, and then you’ll be able to call it recursively.

Extend the timeout after each click on react

Suppose there’s the following simple component. When I click on the button, the message will change to Clicked for 1 second and then goes back to -. However, when I spam the button, I want the title to be Clicked but it should go back to – after the last click of the button. Basically, I want each…