0

I used create-react-app to create this very simple app. ComponentDidMount is never invoked.

import React, { Component } from "react";

class App extends Component {
  ComponentDidMount() {
    console.log("MOUNTED");
  }

  render() {
    return (
      <div className="App">
        <h1>Hi Lol</h1>
      </div>
    );
  }
}

export default App;
icey-t
  • 283
  • 3
  • 11

1 Answers1

4

Method names are case sensitive, so you should start with a lowercase: componentDidMount instead of ComponentDidMount.

Gleb Kostyunin
  • 3,743
  • 2
  • 19
  • 36