Ant*_*ado 3 javascript reactjs eslint webpack eslint-config-airbnb
当我编译我的代码时,ESlint 给了我这个警告。我们正在使用 AirBNB 配置。
import React from 'react';
import { Link } from 'react-router-dom';
const ProfileInterestSkillButtons = ({
tags, title, user, member,
}) => {
return (
<div>
{title}
</div>
);
};
export default ProfileInterestSkillButtons;
Run Code Online (Sandbox Code Playgroud)
Dan*_*uze 10
您的组件正在使用名为的道具 tags
它从其父组件接收。
ESLint 只是警告您在使用它的组件中为该道具定义类型检查。您可以通过使用PropTypes
或 usingflow
。
使用 PropType 的简单示例是:
... // other imports
import PropTypes from 'prop-types';
... // your component declaration
ProfileInterestSkillButtons.propTypes = {
tags: PropTypes.array.isRequired,
title: PropTypes.string.isRequired,
... // and more
};
export default ProfileInterestSkillButtons;
Run Code Online (Sandbox Code Playgroud)
道具类型: https
流程:https : //flow.org/en/docs/react/
归档时间: |
|
查看次数: |
10004 次 |
最近记录: |