Component.js:
<Link to={{ pathname: 'audio-Player', state: { url: 'Demo' } }}> Play</Link>
If I click this Link then the AnitherComponent.js opens and works but if I open this AnitherComponent.js direct, then it says can not read property url at this.props.loaction.url
AnitherComponent.js:
componentDidMount() {
this.state.song.src = this.props.loaction.url
console.log(this.state.song)
this.setState({
play_img: document.querySelector('#play_img'),
range: document.querySelector('#range1'),
})
const { song, range, play_img, total_time, currentTime } = this.state
}