I've looked at other similar questions but can't seem to find an answer...
I'm getting error:
Warning: Failed prop type: The prop
heightis marked as required inAudioPlayer, but its value isundefined.
When trying the following code:
import React, { Component } from "react";
import { Row, Col } from "react-bootstrap";
import Audio from "react-audioplayer";
import "./../../Assets/Css/AudioPlayer.css";
import PropTypes from "prop-types";
export default class AudioPlayer extends Component {
render(props) {
const playlist = this.props.playlist;
const AudioStyles = {
width: "99%",
margin: "1% 0"
};
const AudioProps = {
height: 600,
style: AudioStyles,
playlist: playlist,
fullPlayer: true
};
return (
<Row>
<Col xs={12}>
<Audio {...AudioProps} />
</Col>
</Row>
);
}
}
AudioPlayer.propTypes = {
height: PropTypes.number.isRequired
};
The code still functions as expected but gives the error mentioned above.
Should I be checking prop types differently?
AudioPlayer?AudioPlayer.propTypes = { height: PropTypes.number.isRequired };. it is needed in Audio component.