【问题标题】:JSX Render function not recognized by Visual StudioVisual Studio 无法识别 JSX 渲染函数
【发布时间】:2021-06-18 12:38:45
【问题描述】:

我正在学习一个很棒的 AWS 教程,但我相信 Visual Studio 无法将我的 JSX 返回函数识别为 HTML。其他人有这个问题吗?

VS 希望它看起来如下:

render() {
    return ( <
        section className = "section auth" >
        <
        div className = "container" >
        <
        h1 > Register < /h1> <FormErrors formerrors = { this.state.errors }/ >

        <
        form onSubmit = { this.handleSubmit } >
        <
        div className = "field" >
        <
        p className = "control" >
        <
        input className = "input"
        type = "text"
        id = "username"
        aria - describedby = "userNameHelp"
        placeholder = "Enter username"
        value = { this.state.username }
        onChange = { this.onInputChange }
        /> < /

visual studio auto-formatting

【问题讨论】:

    标签: html reactjs visual-studio jsx


    【解决方案1】:

    Prettier's format on save messes up .jsx files

    这就是答案。禁用 Prettier 以外的所有格式化程序!!

    【讨论】:

      猜你喜欢
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-30
      • 1970-01-01
      • 1970-01-01
      • 2020-03-22
      相关资源
      最近更新 更多