Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? 在使用react封装了一个公用组件时,组件中使用了connect连接redux后的组件,然后其他地方引用该组件后就提示以上警告,虽然不影响使用,但看着不舒服。 解决方法: 导出组件时使用:
常见错误Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?在使用react封装了一个公用组件时,组件中使用了connect连接redux后的组件,然后其他地方引用该组件后就提示以上警告,虽然不影响使用,但看着不舒服。解决方法:导出组件时使用:export default connect(