Skip to content
Advertisement

Tag: react-hooks

Delete an element from the array and update order

I have an array of objects in the state. The object has the order property. I need order prop for drag and drop. The list is sorted by order. Also, there is a function to remove an item from the list. How to correctly remove an element from an array with updating the order property? I wrote this solution based

How to add debounce to useElementSize hook?

I am using the following hook in order to get the width and the height for an element: It works perfectly – when I resize the window I see that the component re-renders every time I resize and it happens very fast. The problem is I have a very big element and I would like to add a debounce to

I am trying to draw circles and add popup on a map, but i keep getting errors. Cannot read properties of undefined (reading ‘lng’)

This piece of code is from my App.js I am using this as the default location of the map once the app opens const [mapCenter, setMapCenter] = useState({lat: 34.80746, lng: -40.4796}); I use this to update the location of the map, as selected from the dropdown menu, I am getting the lat and lng from data pulled from an endpoint

Advertisement