<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

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js