Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Convert DragPreview component to useStyles #3589

Merged
merged 2 commits into from
Aug 23, 2019

Conversation

jaytula
Copy link
Contributor

@jaytula jaytula commented Aug 23, 2019

This is a conversion to useStyles but it is the first that I've done that has life-cycle method shouldComponentUpdate that just returns false.

I did not try to add any memoization because I wouldn't really be understanding whether it worked. Would very much appreciate an explanation how shouldComponentUpdate for this seemingly trivial case should be handled.

Thanks!

@djhi
Copy link
Collaborator

djhi commented Aug 23, 2019

You can wrap it inside a React.memo: https://reactjs.org/docs/react-api.html#reactmemo

@jaytula
Copy link
Contributor Author

jaytula commented Aug 23, 2019

Thanks! Would something like this be the right idea for this particular component?

export default React.memo(DragPreview, () => true);

Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@djhi djhi added this to the 3.0.0 milestone Aug 23, 2019
@fzaninotto fzaninotto merged commit 769a179 into marmelab:next Aug 23, 2019
@jaytula jaytula deleted the usestyles-dragpreview branch August 28, 2019 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants