title: React Router with optional path parameter
body: <p>I want to declare a path with an optional path parameter, hence when I add it the page to do something extra (e.g. fill some data):</p>
  
  <blockquote>
    <p><a href="http://localhost/app/path/to/page" rel="noreferrer">http://localhost/app/path/to/page</a> &lt;= render the page
    <a href="http://localhost/app/path/to/page/pathParam" rel="noreferrer">http://localhost/app/path/to/page/pathParam</a> &lt;= render the page with
    some data according to the pathParam</p>
  </blockquote>
  
  <p>In my react router I have the following paths, in order to support the two options (this is a simplified example):</p>
  
  <pre><code>&lt;Router history={history}&gt;    
     &lt;Route path="/path" component={IndexPage}&gt;
        &lt;Route path="to/page" component={MyPage}/&gt;
        &lt;Route path="to/page/:pathParam" component={MyPage}/&gt;
     &lt;/Route&gt;    
  &lt;/Router&gt;
  </code></pre>
  
  <p>My question is, can we declare it in <strong>one</strong> route? If I add only the second row then the route without the parameter is not found.</p>
  
  <p><strong>EDIT#1:</strong></p>
  
  <p>The solution mentioned <a href="https://stackoverflow.com/questions/32773911/optional-react-router-parameter">here</a> about the following syntax did not work for me, is it a proper one? Does it exist in the documentation?</p>
  
  <pre><code>&lt;Route path="/product/:productName/?:urlID?" handler={SomeHandler} /&gt;
  </code></pre>
  
  <p>My react-router version is: 1.0.3</p>