My onClick function doesn't work and the problem is: "Line 17: 'propTypes' is not defined no-undef Line 18: 'propTypes' is not defined no-undef".
my "text:propType.string" and "color:propTypes.string" are on line 17 and 18. Thank you for helping me!
This is my Button.js file:
import React from 'react';
import PropTypes from 'prop-types';
const Button = ({color, text}) => {
const onClick = () => {
console.log('click')
}
return <button onClick={onClick} style={{backgroundColor:color}} className="btn">{text}</button>
}
Button.defaultProps = {
color:'steelblue',
}
Button.propTypes={
text:propTypes.string,
color:propTypes.string,
}
export default Button