我有一些警告:
Warning: Legacy context API has been detected within a strict-mode tree.
The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.
Please update the following components: Transition
和
Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely in ...
一个月前我没有。
<Modal
style={{position: "relative",
top: "50%",
transform: "translateY(-50%)"}}
className="fadein-elements"
isOpen={modal}
toggle={toggle}
>
<ModalHeader toggle={toggle}>Add Post</ModalHeader>
<ModalBody>
<Form onSubmit={onSubmit}>
<FormGroup>
<Label for="subject">Subject</Label>
<Input
type="text"
name="subject"
id="subject"
placeholder="Add Subject..."
onChange={onChange}
/>
<Label for="content">Content</Label>
<Input
type="textarea"
name="content"
id="content"
placeholder="Add content..."
onChange={onChange}
/>
<Button
color="dark"
style={{ marginTop: '2rem' }}
block>
Add Post
</Button>
</FormGroup>
</Form>
</ModalBody>
</Modal>
应用程序工作正常,但我总是想以正确的方式清除所有警告。我假设我必须从 react-transition-group 添加过渡组件,但是我更喜欢在 CSS 中完成所有过渡和动画(对我来说,使用 react-waypoint 效果更好)。我的反应版本是 16.13.1
最后,我有两个问题。
1)这个警告的目的是什么,这意味着它为什么被弃用?
2)我应该在哪里插入这个 react-group-transition 转换或者我应该如何更改这个 Modal 以清除错误?