0
看看这个类明白proptypes:流量不
/* @flow */
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
const mapStateToProps = (state) => ({
email: ...
});
@connect(mapStateToProps)
class UserControlPanel extends PureComponent {
static propTypes = {
email: PropTypes.string
}
logout = (ev:any) => {
ev.preventDefault();
...
}
render() {
const { email } = this.props;
return (
<div className="ucp">
...
</div>
);
}
}
export default UserControlPanel;
很简单阵营,接受单个字符串支撑命名电子邮件组件类。但是当我运行流量时,它给了我这个错误:
[flow] property
UserControlPanel
See also: React elementUserControlPanel
)
我是错在哪里?我也试过这样:
type Props = {
email: string;
};
@connect(mapStateToProps)
class UserControlPanel extends PureComponent {
props:Props
static propTypes = {
email: PropTypes.string
}
或者这样:
type Props = {
email: string;
};
@connect(mapStateToProps)
class UserControlPanel extends PureComponent<Props> {
static propTypes = {
email: PropTypes.string
}
双方将没有奏效。仅使用Component而不是PureComponent也无效。
如何让流程理解我的道具类型并且不再出现错误信息?
那不是一点,但我刚刚更新了我的流程-bin和现在这个工作。谢谢。 – modernator