<div id="app"></div>
class FirstComponent extends React.Component {
renderGoodWord (goodWord, badWord) {
const isGoodWord = true
return isGoodWord ? goodWord : badWord
}
render() {
return (
<div>
<h1>
React 小书
{ this.renderGoodWord(<strong> is good</strong>, <strong> is not good</strong>)}
</h1>
</div>
)
}
}
ReactDOM.render(<FirstComponent />, document.getElementById('app'))
View Compiled
This Pen doesn't use any external CSS resources.