<div id='root'></div>
body {
  font-family: Helvetica, Arial, sans-serif;
}
View Compiled
/*
 * Our animation test component
 */
class AnimateMe extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      animate: false,
    };
  }

  componentDidMount() {
    this.setState({ animate: true });
  }

  render() {
    return (
      <div
        style={ {
          background: '#eee',
          border: '1px solid black',
          height: this.state.animate ? 250 : 50,
          margin: 20,
          padding: 20,
          transition: 'all 2s',
        } }
      >
        Animate my height. 
        Read the <a href='https://stanko.github.io/react-rerender-in-component-did-mount/'>blog post</a>.
      </div>
    );
  }
}

/*
 * Render component
 */
ReactDOM.render(<AnimateMe />, document.getElementById('root'));
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.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.js