Skip to content

Warnings in react-hotkeys when using React's strict mode #128

@edmorley

Description

@edmorley

Hi!

React 16.3 added a new strict mode, which highlights potential issues in an app (such as those that will cause problems when using the upcoming async mode):
https://reactjs.org/docs/strict-mode.html

Enabling it for our app resulted in several errors coming from react-hotkeys:

Warning: Unsafe lifecycle methods were found within a strict-mode tree:
    in StrictMode (at job-view/index.jsx:28)

componentWillMount: Please update the following components to use componentDidMount instead: 
HotKeys

-> see: https://reactjs.org/docs/strict-mode.html#identifying-unsafe-lifecycles

Warning: Legacy context API has been detected within a strict-mode tree: 
    in StrictMode (at job-view/index.jsx:28)

Please update the following components: HotKeys

-> see: https://reactjs.org/docs/strict-mode.html#detecting-legacy-context-api

Warning: findDOMNode is deprecated in StrictMode.
findDOMNode was passed an instance of HotKeys which is inside StrictMode.
Instead, add a ref directly to the element you want to reference.

    in div (created by FocusTrap)
    in FocusTrap (created by HotKeys)
    ...

-> see: https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage

Many thanks :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions