React Props is Not Defined

I also had some problems using props with my functional components while doing the todo-tutorial. When you use functional components instead of class components, you'll have to do an import from the node-modules if you want to use props. Put this line at the top of your file:

import props from 'prop-types';

Then, when you'll want to use props in your functional component, you'll first need to pass the keyword as a parameter of this function. After that, you'll be allowed to use it like you would have in a class component but without using the keyword "this" :

function Todos(props) {
  console.log(props.todos);
  return (
    <div className="Todos">
        <h2>This is the Todos component</h2>
    </div>
  );
}

you're miss-reading this error. props is not undefined, what is calling props is undefined, which is the this keyword. you can manually set the context of the map function by passing in a second parameter

this.props.buildings.map(this.renderBuildings, this)

or bind it inline

this.props.buildings.map(this.renderBuildings.bind(this))


In my case, I forgot to add props as an argument to the constructor.

constructor(props) {
  super(props);
}