Skip to content
Advertisement

Tag: reactjs

useQuery hook not returning data variable

I have a problem in my useQuery hook from react-query package. Here I call the API using axios and I’m successfully getting the data (I debugged my app). The problem is when I return the result it’s not saving in the data variable of the useQuery hook. Here is my code: Answer because this function isn’t returning anything useQuery needs

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

Avoid Multiple ReRenders React Component after Randomizing component

On page load I want React to render a component randomly because I have two different survey forms that I want randomly assigned to a user. However, because of the multiple re-renders that react goes through the piece of code doesn’t quite work the way I expected. Sometimes, depending on the randomness, <OpenSurvey /> will render first, then you’ll see

React : Cannot set property ‘animation’ of undefined

I have a list in React where I’m using .map to render a loop from an array of elements. The radio inputs are working perfectly, everyone is independent of the others, but I can’t do the same for Select. The Select area is changing in every field, I want it to change to it specified field like I did for

React Functional Component Parent and Child – Unhandled Rejection (TypeError): X is not a function

I have a parent app which contains a handler function (handleChallengeSave). The handler function triggers a useState (setSavedChallenge) in the parent. The handler function is passed down as props to the child. I’m getting an ‘Unhandled Rejection (TypeError): X is not a function’ error. However if I change nothing other than moving the state to the child, it works. Eg:

Advertisement