" in the "main.jsx" file; 2. Where the modal component is used, add two attributes "transitionName="" maskTransitionName to Modal ="""; 3. Upgrade "ant-design"."/> " in the "main.jsx" file; 2. Where the modal component is used, add two attributes "transitionName="" maskTransitionName to Modal ="""; 3. Upgrade "ant-design".">

Home>Article>Web Front-end> What should I do if the modal in react does not take effect?

What should I do if the modal in react does not take effect?

藏色散人
藏色散人 Original
2022-12-30 09:22:09 2423browse

Solution to the problem that modal does not take effect in react: 1. Remove " " in the "main.jsx" file; 2. Where the modal component is used, add two attributes "transitionName" to Modal ="" maskTransitionName="""; 3. Upgrade "ant-design".

What should I do if the modal in react does not take effect?

The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.

What should I do if the modal in react does not take effect?

The modal pop-up window error when using the ant component library in react

Solution to using ant-design in the react project The modal pop-up console in the library reports an error

findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of DomWrapper3 which is inside StrictMode.

What should I do if the modal in react does not take effect?

Root cause of the problem:

Strict mode is turned on in the react scaffolding, which restricts code writing standards. CSSTransition is used in the ant-design component library, but the way of writing some codes in CSSTransition is not the latest way of writing for react, and it is not a verystandardway of writing, so react in strict mode will throw Issue a warning. As a result, the pop-up window cannot be used

What should I do if the modal in react does not take effect?

Solution:

1. Turn off the strict mode of react

Change the main.jsx file Remove. However, in development projects, the React.StrictMode tag is still very important for code verification, so it is best not to turn it off. This method is not recommended. And in the new version of react, removing the strict mode will cause some other problems.

What should I do if the modal in react does not take effect?

2. Do not use the CSSTransition effect in ant-design

Where the modal component is used, add two attributes to Modal

transitionName="" maskTransitionName=""

 

确定删除该代办任务吗?

What should I do if the modal in react does not take effect?

3. You can wait for the ant-design upgrade to solve this problem

Recommended study: "react video tutorial

The above is the detailed content of What should I do if the modal in react does not take effect?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn