与webstorm不同,我无法在Visual Studio Code的.js文件中注释掉JSX代码。

最佳答案

您可以通过{/ ** /}注释掉JSX

范例:

render() {
  return (
    <div>
      <Component1 />
      {/* <Component2 /> */}
    </div>
  )
}

然后将Component2注释掉

08-19 09:17