How to use arePropsEqual in useDrop to increase performance?
See original GitHub issueHow 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:
- Created 4 years ago
- Reactions:8
- Comments:6
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
also looking for a solution! every drop I’m doing is re-rendering all the items in my list
Same problem here