我有以下纯渲染组件:
ExtentHeight
但我在eslint中遇到以下错误:
import React, { PropTypes } from 'react';
import Dropzone from 'react-dropzone';
export const renderDropzone = ({ name, input: { onChange } }) => {
return (
<div>
<Dropzone
name={name}
onDrop={filesToUpload => onChange(filesToUpload)}
/>
<button type="button" className="button">Upload</button>
</div>
);
};
renderDropzone.PropTypes = {
name: PropTypes.string.isRequired,
input: PropTypes.object.isRequired
};
答案 0 :(得分:3)
只是一个错字:
renderDropzone.PropTypes = {
name: PropTypes.string.isRequired
};
应该是:
renderDropzone.propTypes = {
name: PropTypes.string.isRequired
};
(小写&#39; p&#39;在类属性上)