React Native0.63.2选择性忽略一些Warning

有没有人像我一样,看到Warning特别难受,跟吃了苍蝇一样,如果是自己写的代码中有Warning我肯定想尽办法处理掉。但是有的时候是自己引用的一些组件中的Warning天天看到就难受了。解决办法跟大家分享一下。

 版本

"react": "16.13.1",
"react-native": "0.63.2",

比如说,我的警告信息如下:

[Thu Sep 17 2020 16:40:46.170]  WARN     Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: %s Popover
 

import {LogBox} from 'react-native';
LogBox.ignoreLogs(['Warning: componentWillReceiveProps has been renamed']);

这下整个世界都清净了,好舒服。眼不见为净。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值