mobx-react-devtools icon indicating copy to clipboard operation
mobx-react-devtools copied to clipboard

Incompatibility with React.StrictMode

Open elektronik2k5 opened this issue 6 years ago • 1 comments

Hello and thanks for mobx and the devtools! :)

I'm trying to use the devtools in an app while using React's (relatively) new StrictMode. But I'm getting this error:

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

The interesting thing is that it happens even when the devtools aren't mounted to a StrictMode tree:

<>
  <React.StrictMode>
    <TodoList todoStore={store} />
  </React.StrictMode>
  <MobxDevTools />
</>

I'm also able to reproduce the same issue in my real app. Can anything be done about it? If not, we should at least have a note in the README.

Here's a codesandbox where you can see the issue: https://codesandbox.io/s/1jjgxvjzo?autoresize=1&expanddevtools=1&fontsize=14

elektronik2k5 avatar Apr 12 '19 12:04 elektronik2k5

I recommend to use the browser plugin for now. The future of this tool is a bit uncertain, as it might be largely not needed anymore once we standardize on hooks

On Fri, Apr 12, 2019 at 2:07 PM Nick Ribal [email protected] wrote:

Hello and thanks for mobx and the devtools! :)

I'm trying to use the devtools in an app while using React's (relatively) new StrictMode https://reactjs.org/docs/strict-mode.html. But I'm getting this error:

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

The interesting thing is that it happens even when the devtools aren't mounted to a StrictMode tree:

<> <React.StrictMode> <TodoList todoStore={store} /> </React.StrictMode> <MobxDevTools /></>

I'm also able to reproduce the same issue in my real app. Can anything be done about it? If not, we should at least have a note in the README.

Here's a codesandbox where you can see the issue: https://codesandbox.io/s/1jjgxvjzo?autoresize=1&expanddevtools=1&fontsize=14

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx-react-devtools/issues/116, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvGhBc6gSRQgbrsIOAZX-kx-ks54JLOks5vgHb-gaJpZM4cr-uh .

mweststrate avatar Apr 15 '19 11:04 mweststrate