Semantic-Org / Semantic-UI-React

The official Semantic-UI-React integration
https://react.semantic-ui.com
MIT License
13.2k stars 4.04k forks source link

semantic ui react dimmer warning finddomnode is deprecated in strictmode #4438

Closed PTAHume closed 9 months ago

PTAHume commented 9 months ago

When I use Dimmer from semantic-ui-react I get this warning:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of RefFindNode which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node

But as I see the problem with Dimmer was resolved years before: link.

So what's the root of warring and how to avoid it (except to stop using strict mode)?

import React from "react";
import { Dimmer } from "semantic-ui-react";

const App = () => (
  <React.StrictMode>
    <Dimmer>Hey</Dimmer>
  </React.StrictMode>
);
export default App;

Example: React 18.2.0, Semantic-ui-react 2.1.4 Link to codesandbox.io](https://codesandbox.io/s/dimmer-in-strictmode-react-18-2-0-forked-9jn3jn)

I am not the only one who has had this issue either : https://stackoverflow.com/questions/75694953/semant

welcome[bot] commented 9 months ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

layershifter commented 9 months ago

Please try to use v3-beta (https://react.semantic-ui.com/migration-guide), it supports native ref forwarding.

PTAHume commented 9 months ago

thank you thats way better :)