简体   繁体   English

使用 react-transition-group 可以吗?

[英]Is it ok to use react-transition-group?

I've revived warnings from React when using react-transtion-group component (which is Transition ) in React.StrictMode aboutReact.StrictMode中使用 react-transtion-group 组件(即Transition )时,我已经恢复了来自 React 的警告

legacy context API遗留上下文 API

in the Transition component.在过渡组件中。 and

findDOMNode is deprecated. findDOMNode 已弃用。

I intended to use react-transition-group on a big project but know I don't know.我打算在一个大项目上使用 react-transition-group 但我知道我不知道。 Is the library still receiving updates & is it safe to use it?图书馆还在接收更新吗?使用它安全吗?

and if it not, do you have any appropriate replacement?如果没有,您是否有任何合适的替代品?

NOTE: I'm using the latest version of react ^16.8.4 and react-transition-group ^2.6.1注意:我使用的是最新版本的 react ^16.8.4和 react-transition-group ^2.6.1

NOTE2: snapshot of my console注 2:我的控制台快照

Just look on their github repo. 只要看看他们的github仓库。 The answer is yes, they're still updating it as of March 15 2018. I've used it recently and it was fine. 答案是肯定的,截至2018年3月15日,他们仍在对其进行更新。我最近使用过它,很好。

late to answer this question.晚了回答这个问题。 But, you will need to use refs for your components if you are using react strict mode in your development environment.但是,如果您在开发环境中使用 React Strict 模式,则需要为您的组件使用 refs。

You can read this explanation in the doc http://reactcommunity.org/react-transition-group/transition#Transition-prop-nodeRef您可以在文档http://reactcommunity.org/react-transition-group/transition#Transition-prop-nodeRef中阅读此解释

It is likely that you are getting this error because you are using strict mode in development environment.您可能会收到此错误,因为您在开发环境中使用了严格模式。

If you don't use strict mode, you will not see any issue.如果你不使用严格模式,你不会看到任何问题。

Examples:with and without refs, https://github.com/nfabacus/react-transition-group-list-example/blob/main/README.md示例:有和没有 refs, https://github.com/nfabacus/react-transition-group-list-example/blob/main/README.md

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM