我正在Meteor上做一个项目,我在控制台中有一条警告信息。
Warning: MeteorDataContainer: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.
但是在代码中我只使用普通的JavaScript类来创建React组件(删节版本)。
import { Meteor } from 'meteor/meteor';
import React, { Component } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
class Header extends Component {
render() {
return (
<div>{this.props.user}</div>
);
}
}
export default createContainer(() => {
Meteor.subscribe('Meteor.users.public');
return {
user: Meteor.user()
};
}, Header);
如何修复此警告?感谢。