I get this error while following the State Video in the React Course.
Failed to compile.
./src/Components/Coin.jsx
Module not found: Can’t resolve ‘prop types’ in ‘C:\Users\creat\OneDrive\Documents\WebDev\src\Components’`
Here is the code in the Coin.jxs file:
import React, { Component } from 'react'
import "./Coin.css";
import PropTypes from 'prop types';
export default class Coin extends Component {
constructor(props) {
super(props);
this.state = {
price: this.props.price
};
}
componentDidMount() {
const callback = () => {
const randomPercentage = 0.995 + Math.random() * 0.01;
this.setState( function(oldState) {
return {
price: oldState.price * randomPercentage
};
});
}
setInterval( callback, 1000 );
}
render() {
return (
<tr className="coin row">
<td>{this.props.name}</td>
<td>{this.props.ticker}</td>
<td>${this.state.price}</td>
</tr>
);
}
}
Coin.propTypes = {
name: PropTypes.string,
ticker: PropTypes.string,
price: PropTypes.number
}