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;
그것은 간단한 단일 문자열라는 이메일을 소품 받아 Component 클래스 반응이다. 하지만 흐름을 실행하면 다음과 같은 오류가 발생합니다.
[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
}
나는 또한이 시도. PureComponent 대신 Component 만 사용하면 효과가 없습니다.
플로우에서 내 소품 유형을 이해하고 오류 메시지를 더 이상 표시하지 않으려면 어떻게해야합니까?
지적하지 않은,하지만 난 그냥 내 흐름 - 빈 업데이트이 작동합니다. 감사. – modernator