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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With