-
Notifications
You must be signed in to change notification settings - Fork 68
Implement React.memo #252
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
Implement React.memo #252
Conversation
e63bee1
to
e3bdc7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few unused imports that were probably just auto-pulled in while writing the test, but otherwise everything looked great!
@@ -0,0 +1,163 @@ | |||
import 'dart:async'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#nit unused import
import 'dart:async'; |
@@ -0,0 +1,163 @@ | |||
import 'dart:async'; | |||
import 'dart:developer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#nit unused import
import 'dart:developer'; |
import 'dart:developer'; | ||
@TestOn('browser') | ||
import 'dart:html'; | ||
import 'dart:js_util'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#nit unused import
import 'dart:js_util'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@override | ||
render() { | ||
return react.div( | ||
{'key': 'mtdw'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#nit this key is unnecessary
return react.div( | ||
{'key': 'mtdw'}, | ||
MemoTest({ | ||
'localCount': this.state['localCount'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#nit As per the Dart style guide, avoid unnecessary this
….com:cleandart/react-dart into 5.4.0/memo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used the profiler to verify that the props are memoized and the time to commit decreases.
QA +1
# Conflicts: # lib/react_client/react_interop.dart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+10
This PR implements
React.memo
in the Dart API, along with examples and tests.FYA: @greglittlefield-wf @sydneyjodon-wk @joebingham-wk