score:1

Accepted answer

component prop isn't a function. use render instead of component prop.

render prop is a function to which router props object is passed as an argument. you can pass these router props to your component.

<route
  exact
  path="/book/:id"
  render={(props) => <book user={user} {...props} />} 
/>

see react router docs for details on render prop

score:2

this is how you use the component prop

<route exact path="/book/:id" component={book} />

consider using the render prop instead of the component prop like this:

<route exact path="/book/:id" render={(routeprops) => <book user={user} {...routeprops} />} />


Related Query

More Query from same tag