【发布时间】:2023-01-09 19:57:24
【问题描述】:
下面是我的渲染逻辑,我试图在字段集中运行循环,但出现语法错误
Parsing error: '}' expected.eslint
请帮忙
const renderComponentButtons = () => {
const { questionNo } = componentContent;
if (componentContent?.button) {
return (
<fieldset className="col-lg-8" aria-labelledby={componentContent?.ariaLabelledby}>
{
Object.keys(componentContent.button).map((key) => {
<ButtonAction
key={key}
data-testid="getDisputeQst1"
onClick={() => {
return (componentContent.button[key]?.displayModal === 'True')
? openModalWindow(questionNo, key) : moveToNextQuestion(componentContent.button[key].buttonText);
}}
>
{componentContent.button[key].buttonText}
</ButtonAction>
});
}
</fieldset>
);
}
return null;
};
【问题讨论】:
-
您在哪一行看到错误? (此外,您不会从您的
Object.keys(componentContent.button).map(...)返回任何内容)
标签: reactjs