在vscode中使用reactjs报错 [英] Used the reactjs in vscode was report an error

查看:31
本文介绍了在vscode中使用reactjs报错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jsx"Visual Studio 代码中的语法.visual studio代码报错

use "jsx" grammar in visual studio code. visual studio code report an error

请帮助我.谢谢!!!

推荐答案

符号<"应该与标签名称出现在同一行.

The symbol "<" should appear in the same line with the tag name.

例如,而不是这样做:

   return (     <
      button className="square"> {/*TODO*/} <
      /button>
   )

这样做:

  return(
    <button className="square"> 
         {/*TODO*/}
    </button>
)

如果要将标签拆分为多行,你可以这样做:

If you want to split the tag to multiple lines, you can do it like that:

      return (
        <button 
          className="square"
          id="id"
          onClick={someFunc}
        > 
             {/*TODO*/}
        </button>
       )

这篇关于在vscode中使用reactjs报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆