question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use arePropsEqual in useDrop to increase performance?

See original GitHub issue

How can I use arePropsEqual in useDrop? The documentation just says that we can use that inside options. So I added it like this:

const [, drop] = useDrop<TimelineDragObject, void, {}>({
  accept,
  drop: item => {
    ...
  },
  options: {
    arePropsEqual: (props: any, otherProps: any) => {
      console.log('Are props equal');
    },
  },
});
return (
  <DropAreaWrapper
    ref={drop}
    style={{
      left: leftOffset,
      width: rightOffset - leftOffset,
    }}
  />
);

It’s not even running the console log I have added there. Any idea why? I have thousands of drop areas rendered in one component. When I drag one draggable item, all the drop areas get re-rendered.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:6

github_iconTop GitHub Comments

7reactions
tuval10commented, Jun 27, 2020

also looking for a solution! every drop I’m doing is re-rendering all the items in my list

0reactions
demorenocommented, Jun 3, 2022

Same problem here

Read more comments on GitHub >

github_iconTop Results From Across the Web

useDrop - React DnD
The useDrop hook provides a way for you to wire in your component into the DnD system as ... function inside the options...
Read more >
3 small tips for better Redux performance in a React app
In my previous article I went through some core concepts of performance ... easily be relevant to redux and can gradually increase if...
Read more >
useDrop - React-dnd - Breword 文档集合
useDrop. A hook to use the current component as a drop target. ... otherProps) function inside the options object can improve the performance....
Read more >
react-dnd - Bountysource
And I use 8.11.3 on the server to build and an express server to serve the static files ... How to use arePropsEqual...
Read more >
How to Optimize Components to Improve React Performance
How Does React Work? Before we dive into the optimization techniques, we need to have a better understanding of how React works. At...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found