小编Vas*_*nta的帖子

更漂亮与 ? 冲突。(问号和点)在 prop 括号内的 typescript-react 中,有语法错误

表达

<Button
        title={props.children?.toString()}
        buttonStyle={$.buttonStyle}
        titleStyle={$.titleStyle}

      />
Run Code Online (Sandbox Code Playgroud)

给出下一个错误

SyntaxError: Expression expected.
title={props.children?.toString()}
                      ^
Run Code Online (Sandbox Code Playgroud)

有什么办法可以解决吗?
带有 prettier-plugin 的 Eslint 给出了同样的错误。parser-typescript.js 的问题

typescript reactjs prettier

5
推荐指数
1
解决办法
5116
查看次数

标签 统计

prettier ×1

reactjs ×1

typescript ×1