React this.props is undefined

I think you’re missing the following, try replacing your constructor:

constructor(props) {


Try it out, you should get output from this.props.

The constructor for a React component is called before it is mounted.
When implementing the constructor for a React.Component subclass, you
should call super(props) before any other statement. Otherwise,
this.props will be undefined in the constructor, which can lead to
bugs. Source: Component Docs.

Leave a Comment