This is a reference for upgrading your application to v3 of Semantic UI React.
The main change in v3 is the support of native refs to components to avoid usage of deprecated ReactDOM.findDOMNode()
. It means that ref
prop can be used to get a reference to the underlying DOM element instead of a React component instance.
For example, you can use ref
to get a reference to the underlying DOM element of Button
component:
All components from Semantic UI React v3 support native ref forwarding.
Button
, Input
, TextArea
Button
, Input
and TextArea
implemented some methods like focus()
and blur()
on their class instances. However, now you will get a reference to the underlying DOM element instead of a React component instance. You should be able to call these methods directly on the DOM element without any issues.
Ref
componentBecause of the native ref support, Ref
component is no longer needed and was removed as it used deprecated APIs.
As we exported Ref
component and recommended its usage everywhere we moved out Ref
component to a separate package (@semantic-ui-react/component-ref
). This means that you can use it already with both v2 & v3 to make the upgrade smoother.
More details on this change in Semantic-Org/Semantic-UI-React#4286.
Visibility
componentThe main reason is performance that is far away from native APIs. We suggest to use Intersection Observer API directly or via React wrappers, for example: react-intersection-observer.
As it's not a straightforward replacement that may cause issues with adoption we moved out Visibility
component to a separate package (@semantic-ui-react/component-visibility
). This means that you can use it already with v2 or upcoming v3:
More details on this change in Semantic-Org/Semantic-UI-React#4257.
Transition
componentSome static properties on Transition
component were removed:
This properties should not be used in public APIs, but it's still a breaking change.