我在React + Webpack项目中用//
标记了评论,但是注释掉的行无论如何都会在HTML中呈现。我没有发誓我之前没有这种无意的副作用。我无法记住我在设置中发生的任何可能导致此问题的变化。想法?
import React from 'react';
import AppBar from 'material-ui/lib/app-bar';
import NavigationClose from 'material-ui/lib/svg-icons/navigation/close';
import IconButton from 'material-ui/lib/icon-button';
import MenuItem from 'material-ui/lib/menus/menu-item';
import IconMenu from 'material-ui/lib/menus/icon-menu';
import MoreVert from 'material-ui/lib/svg-icons/navigation/more-vert';
export default class Header extends React.Component {
render() {
return <div>
// <h2>This is header</h2>
<AppBar
title="Elite Global"
//iconElementLeft={<IconButton><NavigationClose /></IconButton>}
iconElementRight={
<IconMenu iconButtonElement={
<IconButton><MoreVert /></IconButton>
}>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
} />
</div>
}
}
import React from 'react';
import Header from './header.jsx';
export default () => {
return <div>
<Header />
</div>
}
答案 0 :(得分:1)
您可以这样评论:
render() {
return (
<div>
{
//<div>stuff</div>
}
{/*<div>stuff</div>*/}
</div>
);
}