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
[Snackbar] Convert to function component #15504
Conversation
Don't forget we need to apply this fix: #15231 (comment) |
-static getDerivedStateFromProps(nextProps, prevState) {
- if (typeof prevState.exited === 'undefined') {
- return {
- exited: !nextProps.open,
- };
- }
-
- if (nextProps.open) {
- return {
- exited: false,
- };
- }
-
- return null;
-}
+if (typeof exited === 'undefined') {
+ setExited(!open);
+} else if (open) {
+ setExited(false);
+} I get an error like;
I looked into this a bit more 😅 and if (typeof exited === 'undefined') {
setExited(!open);
} is called 7 times during the initial rendering time, & the although
|
🌮 💯 |
That fix means you no longer need getDerivedStateFromProps |
Yes I am looking into it 😄 😄 I didn't see your comment before I posted that long useless comment of mine 🏷 🤣 |
@joshwooding Can you kindly review, if you think this implementation is okay, should I move towards the tests? |
Looks good so far. |
@material-ui/core: parsed: -0.38% 😍, gzip: -0.14% 😍 Details of bundle changes.Comparing: 72f4f9f...7a65308
|
@adeelibr Well done :) |
Related to #15231