Skip to content
Advertisement

Tag: state

handling mutliple inputs using redux

I have react hooks section in which user can edit input fields, there are hundreds of inputs that is why I need to use redux (newbie to redux though), Live demo on codesandbox: demo so far I have this and here is setting js where I have input fields Expected results: Just when the user types in inputs eg first

Material-UI Select doesn’t update after onChange

I’ve seen this problem about all around the web but nothing could come short of giving me a valid explanation. I’m using Material-UI Select and the good ol’ setState(…) from React (not hooks though) My component is composed essentially of those lines : And my problem is that my Select component dosen’t update its value after selecting another option. So

Set initial class variable from axios request in React

When i call this function it updates the array questions in state and array initialQuestions variable in constructor. The state questions represents the values form inputs. The inputs are handled in child component with this code setQuestions is passed in props as setQuestions={(state) => this.setState({ questions: state })} So when i change the value of inputs the onChange function is

Why is my setState not working when passed as an argument to a function?

For the function fetchApiAndSetStateForWrongGuesses() I pass it two parameters called randNum and wrongGuess. randNum is just a number but wrongGuess is supposed to be a state. The problem is that when I pass wrongGuess to the function fetchApiAndSetStateForWrongGuesses() the setState doesn’t works. By the time it hits the console.log it just prints out an empty string because thats what the

Mutate Vuex array passed in the payload

What’s the technical difference between next two approaches? Example is trivial but when I have huge nested objects, I need to pass lots of IDs in order to find desired object inside the mutation. In second example I pass an array and just mutate it. Again, technically in both examples we invoke the same push method. Am I right? Should

Advertisement