score:3

<Switch>
  <Dashboard {...rest} />
  <Users {...rest} />
  <Quiz {...rest} />
</Switch>

This will not work because Switch expects Routes to be direct children. It cannot perform its logic on arbitrary wrapper components.

I not sure if that would work but you would have to directly export Route from the module:

Dashboard.js

export default (
  <Route exact path="/" render={ props => (
    <Dashboard {...props} /> 
  )}/>
)

but when you do something like this:

export default (stuff) => (
  <Route exact path="/" render={ props => (
     <Dashboard {...props} {...stuff} />
  )}/>
)

Notice that you are not exporting a Route but a functional component that renders Route.

I personally think that you should only export purely components to be rendered without Routes and leave that up to library consumer.


Related Query

More Query from same tag