Conditionally render lyrics based off track index?










0















I'm trying to create a track list. I want to render the track lyrics based off of the track name that was clicked on for the specified id. However, I'm having some trouble doing so.



The data is being fetched from MySQL.



Here is my code:



Model:






var db = require("../dbconnection");

var music =
insertmusicTracks: function(data, callback)
db.query(
"insert music_tracks set track_music_id=?, track_user_id=?, trackName=?, trackLyrics=?",
[data.albumId, data.userId, data.songName, data.songLyrics],
callback
);
,
selectmusicTracks: function(data, callback)
db.query(
"select mo.track_music_id, mo.trackName, mo.trackLyrics, mt.authorName, mt.trackTitle, mt.trackYear, mt.trackcoverImg from music_tracks mo left join music_topics mt on mt.music_id=mo.track_music_id where mo.track_music_id=?",
[data.trackmusicId],
callback
);

;

module.exports = music;





View:






import React from "react";
import Link from "react-router-dom";

import Modal, Button from "react-bootstrap";

import Headericons from "../common/header-icons";
import Header from "../common/header";
import Footer from "../common/footer";
import Addtracklist from "../components/addmusictrack";
import dataTip from "data-tip";

import appController from "../../controllers/appController";

import musicService from "../../services/musicService";

class Musictracks extends React.Component
constructor(props)
super(props);
this.state =
userId: "",
isAdmin: false,
albumName: "",
musicId: this.props.match.params.musicid,
trackData:
;


handleClose = () =>
this.setState( show: false );
;

handleShow = () =>
this.setState( show: true );
;

selectTracks = async () =>
const selectmusicTracks = await musicService.selectmusicTracks(
trackmusicId: this.props.match.params.musicid
);

this.setState(
trackData: selectmusicTracks
);

console.log(this.state);
;

showLyrics = async trackId =>
this.setState(
lyricId: trackId
);
console.log(this.state);
;

async componentDidMount()
if (appController.isAdmin().role_id === 3)
await this.setState(
userId: appController.isAdmin().userID,
isAdmin: true
);

this.setState(
albumName: this.props.match.params.title
);

await this.selectTracks();

await this.showLyrics();


render()
return (
<div className="fluid-container">
<Headericons />
<Header />
<div className="container" id="musictrackContainer">
<h1>appController.removeHyphen(this.state.albumName)</h1>
<div className="row">
<Link className="btn btn-primary" id="previouspage" to="/music">
← Go Back
</Link>
</div>

this.state.isAdmin === true ? (
<div className="row" id="superAdmin">
<div className="col-md-12">
<i
className="far fa-plus-square fa-2x"
onClick=this.handleShow
/>
</div>

<div className="static-modal">
<Modal show=this.state.show onHide=this.handleClose>
<Modal.Header closeButton>
<Modal.Title>Add Track</Modal.Title>
</Modal.Header>
<Modal.Body>
<Addtracklist
albumId=this.state.musicId
userId=this.state.userId
closeModal=this.handleClose
/>
</Modal.Body>
</Modal>
</div>
</div>
) : null
<div className="row">
<div className="col-md-4">
<div className="trackContainer">
<ol>
this.state.trackData.map((rows, index) => (
<div
className="trackName data-tip-right"
data-tip="View " + rows.trackName
key=rows.trackName + "-" + rows.track_music_id
onClick=e => this.showLyrics(index)
>
<li tabIndex=index>
index + 1 + ". " + rows.trackName
<i className="fas fa-arrow-right" />
</li>
</div>
))
</ol>
</div>
</div>
<div className="col-md-8">
// This is where I'm stuck I'm not sure how I can render lyrics based off of the track name.
this.state.trackData.map((row, index) =>
this.state.lyricId === index ? (
<div className="trackLyrics">row.trackLyrics</div>
) : null
)
</div>
</div>
</div>
<Footer />
</div>
);



export default Musictracks;





The above snippet is my attempt to try and render the lyrics based off of track name that the user clicks on.










share|improve this question




























    0















    I'm trying to create a track list. I want to render the track lyrics based off of the track name that was clicked on for the specified id. However, I'm having some trouble doing so.



    The data is being fetched from MySQL.



    Here is my code:



    Model:






    var db = require("../dbconnection");

    var music =
    insertmusicTracks: function(data, callback)
    db.query(
    "insert music_tracks set track_music_id=?, track_user_id=?, trackName=?, trackLyrics=?",
    [data.albumId, data.userId, data.songName, data.songLyrics],
    callback
    );
    ,
    selectmusicTracks: function(data, callback)
    db.query(
    "select mo.track_music_id, mo.trackName, mo.trackLyrics, mt.authorName, mt.trackTitle, mt.trackYear, mt.trackcoverImg from music_tracks mo left join music_topics mt on mt.music_id=mo.track_music_id where mo.track_music_id=?",
    [data.trackmusicId],
    callback
    );

    ;

    module.exports = music;





    View:






    import React from "react";
    import Link from "react-router-dom";

    import Modal, Button from "react-bootstrap";

    import Headericons from "../common/header-icons";
    import Header from "../common/header";
    import Footer from "../common/footer";
    import Addtracklist from "../components/addmusictrack";
    import dataTip from "data-tip";

    import appController from "../../controllers/appController";

    import musicService from "../../services/musicService";

    class Musictracks extends React.Component
    constructor(props)
    super(props);
    this.state =
    userId: "",
    isAdmin: false,
    albumName: "",
    musicId: this.props.match.params.musicid,
    trackData:
    ;


    handleClose = () =>
    this.setState( show: false );
    ;

    handleShow = () =>
    this.setState( show: true );
    ;

    selectTracks = async () =>
    const selectmusicTracks = await musicService.selectmusicTracks(
    trackmusicId: this.props.match.params.musicid
    );

    this.setState(
    trackData: selectmusicTracks
    );

    console.log(this.state);
    ;

    showLyrics = async trackId =>
    this.setState(
    lyricId: trackId
    );
    console.log(this.state);
    ;

    async componentDidMount()
    if (appController.isAdmin().role_id === 3)
    await this.setState(
    userId: appController.isAdmin().userID,
    isAdmin: true
    );

    this.setState(
    albumName: this.props.match.params.title
    );

    await this.selectTracks();

    await this.showLyrics();


    render()
    return (
    <div className="fluid-container">
    <Headericons />
    <Header />
    <div className="container" id="musictrackContainer">
    <h1>appController.removeHyphen(this.state.albumName)</h1>
    <div className="row">
    <Link className="btn btn-primary" id="previouspage" to="/music">
    ← Go Back
    </Link>
    </div>

    this.state.isAdmin === true ? (
    <div className="row" id="superAdmin">
    <div className="col-md-12">
    <i
    className="far fa-plus-square fa-2x"
    onClick=this.handleShow
    />
    </div>

    <div className="static-modal">
    <Modal show=this.state.show onHide=this.handleClose>
    <Modal.Header closeButton>
    <Modal.Title>Add Track</Modal.Title>
    </Modal.Header>
    <Modal.Body>
    <Addtracklist
    albumId=this.state.musicId
    userId=this.state.userId
    closeModal=this.handleClose
    />
    </Modal.Body>
    </Modal>
    </div>
    </div>
    ) : null
    <div className="row">
    <div className="col-md-4">
    <div className="trackContainer">
    <ol>
    this.state.trackData.map((rows, index) => (
    <div
    className="trackName data-tip-right"
    data-tip="View " + rows.trackName
    key=rows.trackName + "-" + rows.track_music_id
    onClick=e => this.showLyrics(index)
    >
    <li tabIndex=index>
    index + 1 + ". " + rows.trackName
    <i className="fas fa-arrow-right" />
    </li>
    </div>
    ))
    </ol>
    </div>
    </div>
    <div className="col-md-8">
    // This is where I'm stuck I'm not sure how I can render lyrics based off of the track name.
    this.state.trackData.map((row, index) =>
    this.state.lyricId === index ? (
    <div className="trackLyrics">row.trackLyrics</div>
    ) : null
    )
    </div>
    </div>
    </div>
    <Footer />
    </div>
    );



    export default Musictracks;





    The above snippet is my attempt to try and render the lyrics based off of track name that the user clicks on.










    share|improve this question


























      0












      0








      0


      1






      I'm trying to create a track list. I want to render the track lyrics based off of the track name that was clicked on for the specified id. However, I'm having some trouble doing so.



      The data is being fetched from MySQL.



      Here is my code:



      Model:






      var db = require("../dbconnection");

      var music =
      insertmusicTracks: function(data, callback)
      db.query(
      "insert music_tracks set track_music_id=?, track_user_id=?, trackName=?, trackLyrics=?",
      [data.albumId, data.userId, data.songName, data.songLyrics],
      callback
      );
      ,
      selectmusicTracks: function(data, callback)
      db.query(
      "select mo.track_music_id, mo.trackName, mo.trackLyrics, mt.authorName, mt.trackTitle, mt.trackYear, mt.trackcoverImg from music_tracks mo left join music_topics mt on mt.music_id=mo.track_music_id where mo.track_music_id=?",
      [data.trackmusicId],
      callback
      );

      ;

      module.exports = music;





      View:






      import React from "react";
      import Link from "react-router-dom";

      import Modal, Button from "react-bootstrap";

      import Headericons from "../common/header-icons";
      import Header from "../common/header";
      import Footer from "../common/footer";
      import Addtracklist from "../components/addmusictrack";
      import dataTip from "data-tip";

      import appController from "../../controllers/appController";

      import musicService from "../../services/musicService";

      class Musictracks extends React.Component
      constructor(props)
      super(props);
      this.state =
      userId: "",
      isAdmin: false,
      albumName: "",
      musicId: this.props.match.params.musicid,
      trackData:
      ;


      handleClose = () =>
      this.setState( show: false );
      ;

      handleShow = () =>
      this.setState( show: true );
      ;

      selectTracks = async () =>
      const selectmusicTracks = await musicService.selectmusicTracks(
      trackmusicId: this.props.match.params.musicid
      );

      this.setState(
      trackData: selectmusicTracks
      );

      console.log(this.state);
      ;

      showLyrics = async trackId =>
      this.setState(
      lyricId: trackId
      );
      console.log(this.state);
      ;

      async componentDidMount()
      if (appController.isAdmin().role_id === 3)
      await this.setState(
      userId: appController.isAdmin().userID,
      isAdmin: true
      );

      this.setState(
      albumName: this.props.match.params.title
      );

      await this.selectTracks();

      await this.showLyrics();


      render()
      return (
      <div className="fluid-container">
      <Headericons />
      <Header />
      <div className="container" id="musictrackContainer">
      <h1>appController.removeHyphen(this.state.albumName)</h1>
      <div className="row">
      <Link className="btn btn-primary" id="previouspage" to="/music">
      ← Go Back
      </Link>
      </div>

      this.state.isAdmin === true ? (
      <div className="row" id="superAdmin">
      <div className="col-md-12">
      <i
      className="far fa-plus-square fa-2x"
      onClick=this.handleShow
      />
      </div>

      <div className="static-modal">
      <Modal show=this.state.show onHide=this.handleClose>
      <Modal.Header closeButton>
      <Modal.Title>Add Track</Modal.Title>
      </Modal.Header>
      <Modal.Body>
      <Addtracklist
      albumId=this.state.musicId
      userId=this.state.userId
      closeModal=this.handleClose
      />
      </Modal.Body>
      </Modal>
      </div>
      </div>
      ) : null
      <div className="row">
      <div className="col-md-4">
      <div className="trackContainer">
      <ol>
      this.state.trackData.map((rows, index) => (
      <div
      className="trackName data-tip-right"
      data-tip="View " + rows.trackName
      key=rows.trackName + "-" + rows.track_music_id
      onClick=e => this.showLyrics(index)
      >
      <li tabIndex=index>
      index + 1 + ". " + rows.trackName
      <i className="fas fa-arrow-right" />
      </li>
      </div>
      ))
      </ol>
      </div>
      </div>
      <div className="col-md-8">
      // This is where I'm stuck I'm not sure how I can render lyrics based off of the track name.
      this.state.trackData.map((row, index) =>
      this.state.lyricId === index ? (
      <div className="trackLyrics">row.trackLyrics</div>
      ) : null
      )
      </div>
      </div>
      </div>
      <Footer />
      </div>
      );



      export default Musictracks;





      The above snippet is my attempt to try and render the lyrics based off of track name that the user clicks on.










      share|improve this question
















      I'm trying to create a track list. I want to render the track lyrics based off of the track name that was clicked on for the specified id. However, I'm having some trouble doing so.



      The data is being fetched from MySQL.



      Here is my code:



      Model:






      var db = require("../dbconnection");

      var music =
      insertmusicTracks: function(data, callback)
      db.query(
      "insert music_tracks set track_music_id=?, track_user_id=?, trackName=?, trackLyrics=?",
      [data.albumId, data.userId, data.songName, data.songLyrics],
      callback
      );
      ,
      selectmusicTracks: function(data, callback)
      db.query(
      "select mo.track_music_id, mo.trackName, mo.trackLyrics, mt.authorName, mt.trackTitle, mt.trackYear, mt.trackcoverImg from music_tracks mo left join music_topics mt on mt.music_id=mo.track_music_id where mo.track_music_id=?",
      [data.trackmusicId],
      callback
      );

      ;

      module.exports = music;





      View:






      import React from "react";
      import Link from "react-router-dom";

      import Modal, Button from "react-bootstrap";

      import Headericons from "../common/header-icons";
      import Header from "../common/header";
      import Footer from "../common/footer";
      import Addtracklist from "../components/addmusictrack";
      import dataTip from "data-tip";

      import appController from "../../controllers/appController";

      import musicService from "../../services/musicService";

      class Musictracks extends React.Component
      constructor(props)
      super(props);
      this.state =
      userId: "",
      isAdmin: false,
      albumName: "",
      musicId: this.props.match.params.musicid,
      trackData:
      ;


      handleClose = () =>
      this.setState( show: false );
      ;

      handleShow = () =>
      this.setState( show: true );
      ;

      selectTracks = async () =>
      const selectmusicTracks = await musicService.selectmusicTracks(
      trackmusicId: this.props.match.params.musicid
      );

      this.setState(
      trackData: selectmusicTracks
      );

      console.log(this.state);
      ;

      showLyrics = async trackId =>
      this.setState(
      lyricId: trackId
      );
      console.log(this.state);
      ;

      async componentDidMount()
      if (appController.isAdmin().role_id === 3)
      await this.setState(
      userId: appController.isAdmin().userID,
      isAdmin: true
      );

      this.setState(
      albumName: this.props.match.params.title
      );

      await this.selectTracks();

      await this.showLyrics();


      render()
      return (
      <div className="fluid-container">
      <Headericons />
      <Header />
      <div className="container" id="musictrackContainer">
      <h1>appController.removeHyphen(this.state.albumName)</h1>
      <div className="row">
      <Link className="btn btn-primary" id="previouspage" to="/music">
      ← Go Back
      </Link>
      </div>

      this.state.isAdmin === true ? (
      <div className="row" id="superAdmin">
      <div className="col-md-12">
      <i
      className="far fa-plus-square fa-2x"
      onClick=this.handleShow
      />
      </div>

      <div className="static-modal">
      <Modal show=this.state.show onHide=this.handleClose>
      <Modal.Header closeButton>
      <Modal.Title>Add Track</Modal.Title>
      </Modal.Header>
      <Modal.Body>
      <Addtracklist
      albumId=this.state.musicId
      userId=this.state.userId
      closeModal=this.handleClose
      />
      </Modal.Body>
      </Modal>
      </div>
      </div>
      ) : null
      <div className="row">
      <div className="col-md-4">
      <div className="trackContainer">
      <ol>
      this.state.trackData.map((rows, index) => (
      <div
      className="trackName data-tip-right"
      data-tip="View " + rows.trackName
      key=rows.trackName + "-" + rows.track_music_id
      onClick=e => this.showLyrics(index)
      >
      <li tabIndex=index>
      index + 1 + ". " + rows.trackName
      <i className="fas fa-arrow-right" />
      </li>
      </div>
      ))
      </ol>
      </div>
      </div>
      <div className="col-md-8">
      // This is where I'm stuck I'm not sure how I can render lyrics based off of the track name.
      this.state.trackData.map((row, index) =>
      this.state.lyricId === index ? (
      <div className="trackLyrics">row.trackLyrics</div>
      ) : null
      )
      </div>
      </div>
      </div>
      <Footer />
      </div>
      );



      export default Musictracks;





      The above snippet is my attempt to try and render the lyrics based off of track name that the user clicks on.






      var db = require("../dbconnection");

      var music =
      insertmusicTracks: function(data, callback)
      db.query(
      "insert music_tracks set track_music_id=?, track_user_id=?, trackName=?, trackLyrics=?",
      [data.albumId, data.userId, data.songName, data.songLyrics],
      callback
      );
      ,
      selectmusicTracks: function(data, callback)
      db.query(
      "select mo.track_music_id, mo.trackName, mo.trackLyrics, mt.authorName, mt.trackTitle, mt.trackYear, mt.trackcoverImg from music_tracks mo left join music_topics mt on mt.music_id=mo.track_music_id where mo.track_music_id=?",
      [data.trackmusicId],
      callback
      );

      ;

      module.exports = music;





      var db = require("../dbconnection");

      var music =
      insertmusicTracks: function(data, callback)
      db.query(
      "insert music_tracks set track_music_id=?, track_user_id=?, trackName=?, trackLyrics=?",
      [data.albumId, data.userId, data.songName, data.songLyrics],
      callback
      );
      ,
      selectmusicTracks: function(data, callback)
      db.query(
      "select mo.track_music_id, mo.trackName, mo.trackLyrics, mt.authorName, mt.trackTitle, mt.trackYear, mt.trackcoverImg from music_tracks mo left join music_topics mt on mt.music_id=mo.track_music_id where mo.track_music_id=?",
      [data.trackmusicId],
      callback
      );

      ;

      module.exports = music;





      import React from "react";
      import Link from "react-router-dom";

      import Modal, Button from "react-bootstrap";

      import Headericons from "../common/header-icons";
      import Header from "../common/header";
      import Footer from "../common/footer";
      import Addtracklist from "../components/addmusictrack";
      import dataTip from "data-tip";

      import appController from "../../controllers/appController";

      import musicService from "../../services/musicService";

      class Musictracks extends React.Component
      constructor(props)
      super(props);
      this.state =
      userId: "",
      isAdmin: false,
      albumName: "",
      musicId: this.props.match.params.musicid,
      trackData:
      ;


      handleClose = () =>
      this.setState( show: false );
      ;

      handleShow = () =>
      this.setState( show: true );
      ;

      selectTracks = async () =>
      const selectmusicTracks = await musicService.selectmusicTracks(
      trackmusicId: this.props.match.params.musicid
      );

      this.setState(
      trackData: selectmusicTracks
      );

      console.log(this.state);
      ;

      showLyrics = async trackId =>
      this.setState(
      lyricId: trackId
      );
      console.log(this.state);
      ;

      async componentDidMount()
      if (appController.isAdmin().role_id === 3)
      await this.setState(
      userId: appController.isAdmin().userID,
      isAdmin: true
      );

      this.setState(
      albumName: this.props.match.params.title
      );

      await this.selectTracks();

      await this.showLyrics();


      render()
      return (
      <div className="fluid-container">
      <Headericons />
      <Header />
      <div className="container" id="musictrackContainer">
      <h1>appController.removeHyphen(this.state.albumName)</h1>
      <div className="row">
      <Link className="btn btn-primary" id="previouspage" to="/music">
      ← Go Back
      </Link>
      </div>

      this.state.isAdmin === true ? (
      <div className="row" id="superAdmin">
      <div className="col-md-12">
      <i
      className="far fa-plus-square fa-2x"
      onClick=this.handleShow
      />
      </div>

      <div className="static-modal">
      <Modal show=this.state.show onHide=this.handleClose>
      <Modal.Header closeButton>
      <Modal.Title>Add Track</Modal.Title>
      </Modal.Header>
      <Modal.Body>
      <Addtracklist
      albumId=this.state.musicId
      userId=this.state.userId
      closeModal=this.handleClose
      />
      </Modal.Body>
      </Modal>
      </div>
      </div>
      ) : null
      <div className="row">
      <div className="col-md-4">
      <div className="trackContainer">
      <ol>
      this.state.trackData.map((rows, index) => (
      <div
      className="trackName data-tip-right"
      data-tip="View " + rows.trackName
      key=rows.trackName + "-" + rows.track_music_id
      onClick=e => this.showLyrics(index)
      >
      <li tabIndex=index>
      index + 1 + ". " + rows.trackName
      <i className="fas fa-arrow-right" />
      </li>
      </div>
      ))
      </ol>
      </div>
      </div>
      <div className="col-md-8">
      // This is where I'm stuck I'm not sure how I can render lyrics based off of the track name.
      this.state.trackData.map((row, index) =>
      this.state.lyricId === index ? (
      <div className="trackLyrics">row.trackLyrics</div>
      ) : null
      )
      </div>
      </div>
      </div>
      <Footer />
      </div>
      );



      export default Musictracks;





      import React from "react";
      import Link from "react-router-dom";

      import Modal, Button from "react-bootstrap";

      import Headericons from "../common/header-icons";
      import Header from "../common/header";
      import Footer from "../common/footer";
      import Addtracklist from "../components/addmusictrack";
      import dataTip from "data-tip";

      import appController from "../../controllers/appController";

      import musicService from "../../services/musicService";

      class Musictracks extends React.Component
      constructor(props)
      super(props);
      this.state =
      userId: "",
      isAdmin: false,
      albumName: "",
      musicId: this.props.match.params.musicid,
      trackData:
      ;


      handleClose = () =>
      this.setState( show: false );
      ;

      handleShow = () =>
      this.setState( show: true );
      ;

      selectTracks = async () =>
      const selectmusicTracks = await musicService.selectmusicTracks(
      trackmusicId: this.props.match.params.musicid
      );

      this.setState(
      trackData: selectmusicTracks
      );

      console.log(this.state);
      ;

      showLyrics = async trackId =>
      this.setState(
      lyricId: trackId
      );
      console.log(this.state);
      ;

      async componentDidMount()
      if (appController.isAdmin().role_id === 3)
      await this.setState(
      userId: appController.isAdmin().userID,
      isAdmin: true
      );

      this.setState(
      albumName: this.props.match.params.title
      );

      await this.selectTracks();

      await this.showLyrics();


      render()
      return (
      <div className="fluid-container">
      <Headericons />
      <Header />
      <div className="container" id="musictrackContainer">
      <h1>appController.removeHyphen(this.state.albumName)</h1>
      <div className="row">
      <Link className="btn btn-primary" id="previouspage" to="/music">
      ← Go Back
      </Link>
      </div>

      this.state.isAdmin === true ? (
      <div className="row" id="superAdmin">
      <div className="col-md-12">
      <i
      className="far fa-plus-square fa-2x"
      onClick=this.handleShow
      />
      </div>

      <div className="static-modal">
      <Modal show=this.state.show onHide=this.handleClose>
      <Modal.Header closeButton>
      <Modal.Title>Add Track</Modal.Title>
      </Modal.Header>
      <Modal.Body>
      <Addtracklist
      albumId=this.state.musicId
      userId=this.state.userId
      closeModal=this.handleClose
      />
      </Modal.Body>
      </Modal>
      </div>
      </div>
      ) : null
      <div className="row">
      <div className="col-md-4">
      <div className="trackContainer">
      <ol>
      this.state.trackData.map((rows, index) => (
      <div
      className="trackName data-tip-right"
      data-tip="View " + rows.trackName
      key=rows.trackName + "-" + rows.track_music_id
      onClick=e => this.showLyrics(index)
      >
      <li tabIndex=index>
      index + 1 + ". " + rows.trackName
      <i className="fas fa-arrow-right" />
      </li>
      </div>
      ))
      </ol>
      </div>
      </div>
      <div className="col-md-8">
      // This is where I'm stuck I'm not sure how I can render lyrics based off of the track name.
      this.state.trackData.map((row, index) =>
      this.state.lyricId === index ? (
      <div className="trackLyrics">row.trackLyrics</div>
      ) : null
      )
      </div>
      </div>
      </div>
      <Footer />
      </div>
      );



      export default Musictracks;






      mysql node.js reactjs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 22:06







      Curious13

















      asked Nov 13 '18 at 21:55









      Curious13Curious13

      10714




      10714






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Nevermind I figured it out. I made a small error in my code. I simply had to replace row.index with index and it worked. Edited my question.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290107%2fconditionally-render-lyrics-based-off-track-index%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Nevermind I figured it out. I made a small error in my code. I simply had to replace row.index with index and it worked. Edited my question.






            share|improve this answer



























              0














              Nevermind I figured it out. I made a small error in my code. I simply had to replace row.index with index and it worked. Edited my question.






              share|improve this answer

























                0












                0








                0







                Nevermind I figured it out. I made a small error in my code. I simply had to replace row.index with index and it worked. Edited my question.






                share|improve this answer













                Nevermind I figured it out. I made a small error in my code. I simply had to replace row.index with index and it worked. Edited my question.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 22:07









                Curious13Curious13

                10714




                10714



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290107%2fconditionally-render-lyrics-based-off-track-index%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3

                    Museum of Modern and Contemporary Art of Trento and Rovereto