PropTypes doesn't show warnings


#1

Hi, I am learning react by video tutorial and I have issue with PropTypes.

If I remove title or subtitle from this:
<TitleBar title="Test title"/>
The code still works normal without warrnings in console even if it’s required.

import React from 'react';
import PropTypes from 'prop-types';

export default class TitleBar extends React.Component {
  render(){
    return (
      <div>
        <h1>{this.props.title}</h1>
      </div>
    );
  }
}

TitleBar.propTypes = {
  title: PropTypes.string.isRequired
};

I also tired to copy/paste official Meteor React tutorial and I got the same problem.
It looks like propTypes don’t effect TitleBar class at all.

Please help


#2

Just a stupid question: You are looking in the console for the error, right?


#3

Yes, I want to display error in console. Also I don’t know why is it working normal even if I change string to array, object,…


#4

I created frash project and I fallow this tutorial https://www.meteor.com/tutorials/react/creating-an-app
and I stop on the secondd page.

import React, { Component, PropTypes } from 'react';
 
export default class Task extends Component {
  render() {
    return (
      <li>{this.props.task.text}</li>
    );
  }
}
 
Task.propTypes = {
  task: PropTypes.string.isRequired,
};

What is the purpose of PropTypes if doesn’t do nothing?
If I set it to bool or array it should show warnings in the console, but it doesn’t do nothing.
Or If I remove “task={task}” it should also show warning.

This is very frustrating, If even official tutorials don’t work as expected.


#5

Yup same for me - windows 7 -
I don’t have the unwanted extra comma that xstyler has either


#6

I format my computer and start from the beginning and I got the same problem again. Something must be wrong with the meteor.


#7

I found a solution. I uninstall meteor and install npm express and react. Now everything works.


#8

This is still an issue with Meteor 1.6