Skip to content
Advertisement

Tag: react-hooks

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

Using Redux Hooks in a Formik onSubmit

i am currently trying to solve a homework for my university. We should integrate Action Creators and Reducers to our react project. The project is about having a Money Transaction Form with a List which shows all money transactions. Image of the Application We built the form with help of formik, my code looks like this. The Form is a

My hooks aren’t opening and closing my modals

I’m new to react and redux, I’m trying to do things the newish hooks way and running into issues opening and closing a Modal using a redux state. Basically, as soon as my page loads, the modal opens, even though the initial state in the slice is set to false and the close button in the modal footer doesn’t close

Stale closures with react hooks and click events

I have created a codesandbox for easier debugging: https://codesandbox.io/s/hardcore-dirac-nh4iz?file=/src/App.tsx I have built a DataList component that I use like: All of the functionality is handled inside of a useListBox hook, which includes taking the onSelect prop from each child and binding that to a click event on the List itself. However, a stale closure is preventing the count value from

React Hooks TypeError: todos is undefined

I am using PERN Stack with bootstrap for styling. So, I want to access my JSON data and show it in the form of todo lists. When I tried using map function I got TypeError: Here is the code: Answer I misspelled my variable. So, the problem was I was writing jsonData.data.todos instead off jsonData.data.toDos .

Plot histogram in ReactJS

Suppose I want to plot histogram for time taken to read each book. I calculated time to read each book and stored in an array as As I gone through different methods on how to plot histogram …. I found that to display data , it should be in range as: But on basis of my previous data how can

Advertisement