Function (http-request) is running without a Functioncall

I’m working on the React-Project “Build a Camper Leaderboard” and in one of my three modules I have the problem, that the function componentDidMount is running without any call in this or a other module.

The whole code on Codepen:

Here you can see the LeaderBoardTableBody Module:

var LeaderBoardTableBody = React.createClass({
  getInitialState: function() {
    return {
      nr: '',
      name: '',
      picUrl: '',
      points30Days: '',
      pointsAllTime: ''
  componentDidMount: function() {
    var xhr = new XMLHttpRequest();"GET", this.props.source, true); 
    xhr.onreadystatechange = function () { 
      if (xhr.readyState != 4 || xhr.status != 200) {
      } else {
        var response = JSON.parse(xhr.responseText);
  render: function() {
    return (

This is not a problem. It is how React works. You don’t call Lifecycle Methods yourself, they are executed by React “at specific points in a component’s lifecycle”.

1 Like

Thanks for your answer :slight_smile: This link is very usefull!