Мне удалось исправить ваш код, были различные проблемы.попробуйте этот код для html / inline js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1" />
<title>Demo</title>
<link rel="stylesheet" type="text/css" href="maini.css" />
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/babel">
class Comment extends React.Component {
constructor(props) {
super(props);
this.state = {
editing: false
};
this.edit = this.edit.bind(this);
this.remove = this.remove.bind(this);
this.save = this.save.bind(this);
this.renderNormal = this.renderNormal.bind(this);
this.renderForm = this.renderForm.bind(this);
}
edit() {
this.setState({ editing: true });
}
remove() {
console.log("removing comment");
}
save() {
this.setState({ editing: true });
}
renderNormal() {
return (
<div className="commentContainer">
<div className="commentText">{this.props.children}</div>
<button onClick={this.edit} className="button-primary">
{" "}
Editoi
</button>
<button onClick={this.remove} className="button-danger">
{this.props.children}{" "}
</button>
</div>
);
}
renderForm() {
return (
<div className="commentContainer">
<div>defaultValue={this.props.children}</div>
<button onClick={this.save} className="button-success">
{" "}
Save
</button>
</div>
);
}
render() {
if (this.state.editing) {
return this.renderForm();
} else {
return this.renderNormal();
}
}
}
ReactDOM.render(
<div className="board">
<Comment> Hey my name is james</Comment>
<Comment> Beand</Comment>
<Comment> Tuna</Comment>
</div>,
document.getElementById("container")
);
</script>
</body>
</html>
Обратите внимание, что мне пришлось удалить ваш импорт, чтобы заставить его работать, импорт реакции не нужен.и импорт стиля, который вы должны выяснить самостоятельно.Этот код будет отображать ваш HTML, и вы сможете добиться прогресса оттуда.