>

CODEMASTERYLAB

IDE PLATFORM
CoursesCommunity BlogsKnowledge GraphQuizzesInterview Prep

Sign in to track progress & earn XP

Sign In Create Account
>
Code Mastery Lab

Code Mastery Lab

Sign In

The Virtual DOM — How React Actually Works

Question 1 / 1

0:00
Core
Medium

A developer writes the following Pure React code:

const ColorCard = React.createClass({
  render() {
    return React.createElement(
      'div',
      { class: 'color-card' },
      React.createElement('h2', null, this.props.title),
      React.createElement('p', null, `Rating: ${this.props.rating}/5`)
    )
  }
})

ReactDOM.render(
  React.createElement('ColorCard', { title: 'Rad Red', rating: 4 }),
  document.getElementById('root')
)

The developer sees no JavaScript errors but the component doesn't render as expected. There are two bugs. What are they?