title: React filter array based on this.props.params.id
body: <p>I have the following component:</p>
  
  <pre><code>import React from 'react';
  
  import porgectsCollection from './../data/projectInfo.js';
  
  class SingleProject extends React.Component {
    getProjectId() {
      let projectID = porgectsCollection.filter(el =&gt; {
          return (el.title = {this.props.params.id});
      });
    }
    render () {
      console.log(this.getProjectId);
      return (
          &lt;div&gt;
              &lt;h2&gt;{this.props.params.id}&lt;/h2&gt;
          &lt;/div&gt;
      );
    }
  }
  
  export default SingleProject;
  </code></pre>
  
  <p>and my routes.jsx as follow:</p>
  
  <pre><code>import React from 'react';
  import { Route, Router, IndexRoute } from 'react-router';
  import ReactDOM from 'react-dom';
  
  import Wrapper from './../wrapper.jsx';
  import Home from './../home.jsx';
  import Projects from './../projects.jsx';
  import SingleProject from './../singleProject.jsx';
  
  ReactDOM.render((
      &lt;Router&gt;
          &lt;Route component={Wrapper} &gt;
              &lt;Route path="/" component={Home} /&gt;
              &lt;Route path="projects" component={Projects} /&gt;
              &lt;Route path="projects/:id" component={SingleProject} /&gt;
          &lt;/Route&gt;
      &lt;/Router&gt;
  ), document.getElementById('app'));
  </code></pre>
  
  <p>Based on the id passed in:</p>
  
  <pre><code>&lt;Route path="projects/:id" component={SingleProject} /&gt;
  </code></pre>
  
  <p>I want to get that value and filter through the array coming from: </p>
  
  <pre><code>import porgectsCollection from './../data/projectInfo.js';
  </code></pre>
  
  <p>I am then trying to use this function:</p>
  
  <pre><code>  getProjectId() {
      let projectID = porgectsCollection.filter(el =&gt; {
          return (el.title = {this.props.params.id});
      });
    }
  </code></pre>
  
  <p>to display the correct data.</p>
  
  <p>I am not sure if this is the right approach however I am also getting an error when I run webpack:</p>
  
  <p><em>unexpected token referring to {this.props.params.id}</em></p>