title: Using custom router switch in React Router
body: <p>What is the different between this two code?</p>
  <pre><code>const GenerateRoute = ({ route }) =&gt; {
    return &lt;Route exact={route.exact} path={route.route} render={() =&gt; &lt;route.component /&gt;} /&gt;;
  };
  
  return (
    &lt;Switch location={location}&gt;
      {MenuItem.map(item =&gt; (
        &lt;GenerateRoute route={item} /&gt;
      ))}
    &lt;/Switch&gt;
  )
  </code></pre>
  <pre><code>return (
    &lt;Switch location={location}&gt;
      {MenuItem.map(item =&gt; (
        &lt;Route exact={item.exact} path={item.route} render={() =&gt; &lt;item.component /&gt;} /&gt;
      ))}
    &lt;/Switch&gt;
  )
  </code></pre>
  <p>because the first one is not working as I expected while the second one does.</p>
  <p>is React Router Switch not support custom Route component? or how the code supposed to be if I want to using my custom function to generate Route component?</p>
  <p>Thanks</p>