Reputation: 31
Just imported and already a mistake, is it my project or the library?
npm install react-number-easing --save
TypeError: Cannot read property 'any' of undefined
var NumberEasing = React.createClass({
34 | displayName: 'NumberEasing',
35 | propTypes: {
> 36 | value: React.PropTypes.any.isRequired,
37 | speed: React.PropTypes.number,
38 | ease: React.PropTypes.oneOf(Object.keys(eases)),
39 | useLocaleString: React.PropTypes.bool,
When I use my code
<NumberEasing
value={15}
speed={300}
ease='quintInOut' />
Upvotes: 1
Views: 324
Reputation: 5707
It appears that react-number-easing
is based on a version of React which included Proptypes (the module's last release was 4 years ago). The PropTypes property was removed from the React object in v16, so you can either downgrade to React v15 or update the module to use the prop-types
package by either forking it or submitting a PR.
or just maybe..
import React from "react";
import PropTypes from "prop-types";
React.PropTypes = PropTypes;
Upvotes: 2
Reputation: 10964
Looks like you dont have prop-types installed/imported. Make sure to install and import it in the file as follows:
npm install --save prop-types
import PropTypes from 'prop-types'; // ES6
var PropTypes = require('prop-types'); // ES5 with npm
Read this for detailed explanation: https://www.npmjs.com/package/prop-types
Upvotes: 1