Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Bootstrap and React.PropTypes validation function

I have a Rails 5 application on which I've installed browserify and react-rails. I'm able to load components and install packages using npm. The browser console when loading some external packages i.e. react-bootstrap components is filled with 'Warning: You are manually calling a React.PropTypes validation function for the....' for each single available prop on a component.

I have looked everywhere, but I don't understand how to fix these warnings. Similar questions have been asked here but this does not seem to have an answer applicable to my issue.

Here are my files:

package.json

{
  "name": "myapp",
  "version": "1.0.0",
  "dependencies": {
    "bootstrap": "^3.3.7",
    "browserify": "^13.1.0",
    "browserify-incremental": "^3.0.1",
    "fetch": "^1.1.0",
    "jquery": "^3.1.1",
    "jquery-ui": "^1.12.1",
    "jquery-ujs": "^1.2.2",
    "react": "^15.3.2",
    "react-bootstrap": "^0.30.4",
    "react-dom": "^15.3.2",
    "reactify": "^1.1.1",
    "sweetalert-react": "^0.4.4"
  }
}

application.js

//= require_self
//= require react-server
//= require react_ujs


window.$ = window.jQuery = global.$ = require('jquery');
var React = window.React = global.React = require('react');
var ReactDOM= window.ReactDOM = global.ReactDOM = require('react-dom');
require( 'jquery-ujs' );
require( 'jquery-ui' );
require( 'bootstrap' );
require( 'react-bootstrap' );
require( 'fetch' );
require( './components' );

components.js

var app = window.app = global.app = {};

// Component::Manifest
var AdminDashboard = require( 'components/dashboards/admin' );

app.AdminDashboard = AdminDashboard

admin.js.jsx

var ButtonToolbar = require('react-bootstrap').ButtonToolbar;
var Button = require('react-bootstrap').Button;
var Admin = React.createClass({

  handleClick(){
    alert('This was clicked');
  },


  render: function() {

    return (
      <ButtonToolbar bsClass="btn-group">
        <Button active={true} bsStyle="primary" onClick={this.handleClick}>Primary</Button>
      </ButtonToolbar>
  );
  }
});

module.exports = Admin;

How do I get rid of this warning if it's related to an external package and its components?

like image 283
HermannHH Avatar asked Oct 02 '16 13:10

HermannHH


1 Answers

This might help - https://facebook.github.io/react/warnings/dont-call-proptypes.html. Basically the library you're using react-bootstrap might be using PropTypes in a way that is unsupported by React.

like image 65
g2jose Avatar answered Sep 29 '22 13:09

g2jose