docs(Visibility|Ref): deprecate components #4324
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR marks
Visibility
andRef
components as deprecated. We will remove them in the next major release, i.e.3.0.0
.<Ref />
Internally this component uses
ReactDOM.findDOMNode()
that has been deprecated in StrictMode (#3819). It's not supported in Concurrent mode, too ( ´・・)ノ(._.) This means that usage of
.findDOMNode()` will be problem with upcoming React 18.Migration
Semantic UI React v3 will support native ref forwarding via
React.forwardRef()
, but to prevent breaks during upgrade we suggest to import it from a dedicated package:<Visibility />
The main reason for deprecation and upcoming removal is performance that is far away from native APIs, even in our docs we use Intersection Observer API (#3985).
Migration
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: