-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
React 16.13 #1145
React 16.13 #1145
Conversation
- run initialization code in side-effect function
|
||
initialization(props) { | ||
useEffect(() => { |
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.
Rewriting the ApiController as a functional component allows the use of useEffect
which covers didMount / didUpdate lifecycle events. willReceiveProps is now also covered by it because the two first lifecycle methods already cover the same grounds, if slightly differently.
@@ -60,8 +47,16 @@ class UnconnectedContainer extends Component { | |||
} | |||
|
|||
if (isEmpty(dependenciesRequest)) { | |||
dispatch( | |||
apiThunk('_dash-dependencies', 'GET', 'dependenciesRequest') | |||
setTimeout( |
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.
remove setTimeout (experiment)
@@ -102,6 +102,7 @@ | |||
"no-new-wrappers": ["error"], | |||
"no-param-reassign": ["error"], | |||
"no-process-env": ["warn"], | |||
"no-prototype-builtins": ["off"], |
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.
myObject.hasOwnProperty(...)
is fine
@@ -141,7 +142,7 @@ | |||
}], | |||
"no-magic-numbers": ["error", { | |||
"ignoreArrayIndexes": true, | |||
"ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25] | |||
"ignore": [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 10, 16, 0.5, 25, 200, 500] |
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.
some xhr return codes
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.
Looks great! I like the functional components & hooks, let's do more of those :)
💃
Closes https://github.com/plotly/dash-core/issues/75
Update version of React to 16.13 (rewrite ApiController as a functional component)
Update some usage based on modified eslint recommended rules
Testing out with
dash-docs