Skip to content

Tag: reactjs

Issue when trying to set one of div as selected in React JS

I have following code. I’m trying to store a value in my state and every time the user goes to the previous step he can see what he has selected and after that he can change and move on to the next step. At the first step, everything works good. For example, the user selects the second text and proceeds

What is an acceptable render time for a react app?

In the “React Developer Tools” extension, a profiler has been added that displays the time spent on rendering. Are there any guidelines/table? For example, an acceptable render time for an average web application should be 50-300ms. Or like performance index in chrome developer tool? Answer In gen…

How to find item in array in React

I want to retrieve data from a json file and then match it with the value of an existing variable and if the variable value matches the data in json it will display a message “a” and if it does not match it will display a message “b”. the json file is like this Answer What you want is …

How to change text on mouse event in React

I’m trying to use the onMouseDown event in react to change the text but it doesn’t work. I saw a similar code which actually worked so I have no idea what could be wrong. Console says Uncaught TypeError: this.setState2 is not a function The first state which changes images on button click actually…

Saving the state of the button onClick

I have: This pattern works fine, but whenever on the page more then 1 attribute and user select more then one, previously selected button gets unclicked. My question is: How can I save the state of 1st selected button after clicking on 2nd one? for each attribute only one button can be active buttons name sho…