Typescript 必须在类名中使用解构道具赋值
我已将ESLint Airbnb标准应用于我的代码,如:Typescript 必须在类名中使用解构道具赋值,typescript,cypress,eslint-config-airbnb,Typescript,Cypress,Eslint Config Airbnb,我已将ESLint Airbnb标准应用于我的代码,如: <Button ref={anchorRef} aria-controls={open ? 'menu-list-grow' : undefined} aria-haspopup="true" onClick={handleToggle} className={`estimate + ${props.id}`} // for purpose of Cypress > 我认为我为Cy
<Button
ref={anchorRef}
aria-controls={open ? 'menu-list-grow' : undefined}
aria-haspopup="true"
onClick={handleToggle}
className={`estimate + ${props.id}`} // for purpose of Cypress
>
我认为我为Cypress做了一些不好的事情,但是如何改进呢?你的类属性
className={`estimate + ${props.id}`}
将扩展到类似
<button class="estimate + 42">
问题还在于,我曾两次尝试获取
id
,我尝试props.id
,但是:
const {
deleteEstimate /* eslint-disable-line no-shadow */,
downloadReport /* eslint-disable-line no-shadow */,
setNotification,
id,
name,
tableRow,
} = props;
const {
deleteEstimate /* eslint-disable-line no-shadow */,
downloadReport /* eslint-disable-line no-shadow */,
setNotification,
id,
name,
tableRow,
} = props;