Currently, we only support passing Components like this:
<Route component={Foo} />
It is a requirement to also be able to pass props during render time like this:
const bar = {};
<Route
path="/foo"
exact
component={routeProps => (
<Foo
bar={bar} // pass bar to <Foo> on route match
{...routeProps}
/>
)}
/>
Re-using the component prop for stateless components like above example means React would unmount and mount the component again, which is not a desired output.
So I suggest having a new prop, and call it render, that would take care of accepting stateless components and rendering them directly:
Currently, we only support passing Components like this:
It is a requirement to also be able to pass props during render time like this:
Re-using the
component
prop for stateless components like above example means React would unmount and mount the component again, which is not a desired output.So I suggest having a new prop, and call it
render
, that would take care of accepting stateless components and rendering them directly: