Practice Project: Jammming | Codecademy
Everything was going fine but once I got to step 34 which I have to add a .map(), the console gives me the following error Uncaught TypeError: Cannot read properties of undefined (reading ‘map’). I tried following the 15mins prior to this step of the walkthrough video and I didn’t have to change much, I had the classes exported my doing “export class…” now I removed that and added “export default name” at the end of the js because thats how the walkthrough was doing it, still nothing, if someone can help me.
App.js ;
[codebyte language=javascript]
import React from "react";
import { ReactDOM } from "react";
import './Track.css';
class Track extends React.Component {
renderAction() {
if (this.props.isRemoval === true) {
return <button className="Track-action">-</button>
} else {
return <button className="Track-action">+</button>
}
}
render() {
return(
<div className="Track">
<div className="Track-information">
<h3>track name will go here</h3>
<p> track artist will go here \ track album will go here</p>
</div>
{this.renderAction()}
</div>
)
}
}
export default Track;
[/codebyte]
SearchResults.js:
[codebyte language=javascript]
import React from "react";
import { ReactDOM } from "react";
import './Track.css';
class Track extends React.Component {
renderAction() {
if (this.props.isRemoval === true) {
return <button className="Track-action">-</button>
} else {
return <button className="Track-action">+</button>
}
}
render() {
return(
<div className="Track">
<div className="Track-information">
<h3>track name will go here</h3>
<p> track artist will go here \ track album will go here</p>
</div>
{this.renderAction()}
</div>
)
}
}
export default Track;
[/codebyte]
TrackList.js:
[codebyte language=javascript]
import React from “react”;
import ReactDOM from “react”;
import ‘./SearchBar.css’;
class SearchBar extends React.Component {
render() {
return (
SEARCH
)
}
}
export default SearchBar;
[/codebyte]
Track.js:
[codebyte language=javascript]
import React from “react”;
import { ReactDOM } from “react”;
import ‘./Track.css’;
class Track extends React.Component {
renderAction() {
if (this.props.isRemoval === true) {
return -
} else {
return +
}
}
render() {
return(
track name will go here
track artist will go here \ track album will go here
{this.renderAction()}
)
}
}
export default Track;
[/codebyte]