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
Tag: reactjs
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 apply classList.toggle(“active”) in reactjs
How to apply classList.toggle(“active”) in reactjs. i create a two buttons and give onclick function togglePopup and define it at top. but i’m confused how to apply document.getElementById(‘popup-1’).classList.toggle(“active”)in react. i apply this method in javaScrip…
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 …
changing from old syntax of React Router: rendering white screen
I have been following the Learning React: A Hands-On Guide to Building Web Applications Using React and Redux book but as it is the old book so some of its syntax have been changed. Now, I am at the react router chapter and have to change old syntax to current version. The code examples of the books are as fo…
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…
REACT JS – Working on eshop-like project, got stuck with product filters
So hello. I’ve been working on my own stuff as I believe it is the best way to learn things. So I got stuck, I am quite new to this react thing. I got this code, as you can see I have few checkboxes there, and what I want to achieve is to check the box to filter (hide) products
Can’t perform a React state update on an unmounted component Error on Firebase onAuthStateChanged
I am trying to route to ‘/’ after the user successfully logs in. Currently, in my Login.JS file, I have the handleSubmit function that gets the result from the form: Then, I have a AuthContext that passes the Login context I can see that the user is able to LogIn, however, it doesn’t render …
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…
How to Fetch from my local host? Connect React.js to Node.js
Creating my first MERN application and connected the frontend to the backend. Taking baby steps and trying to simply call the already existing “books” in my mongo database. Heres what I have I keep getting the error Answer You need to return the response.json().