dcc.DatePicker - Deprecated lifecycle method

@adamschroeder @AnnMarieW

While styling a dcc.DatePickerSingle component, I noticed the following warning in the browser’s console:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

  • Move data fetching code or side effects to componentDidUpdate.
  • If you’re updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
  • Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.

Please update the following components: n

I got dash 2.13.0 and dash-core-components 2.0.0 running. Below is the 'Minimal Working example:

from dash import Dash, dcc, html



app = Dash(__name__)

app.layout = html.Div(
    dcc.DatePickerSingle()
)

if __name__ == '__main__':
    app.run_server(debug=True)

Note: this warning is also thrown for the dcc.DatePickerRange.

Please let me know whether this has some potential security implications and if it should be updated.

Best,
Ivo

hi @ivo
That is a deprecation warning for a function that was renamed. You’re most likely using an old version of dash since this had been renamed already in DatePickerSingle.

This warning can be safely ignored, because it only appears in dev mode.

I’ll also tack on, this I believe is not unsafe in terms of a security issue, but unsafe in the event that you cant count on it to render things passed in this event. It’s really only for a developer.