passing data by react router dom code example
Example 1: passing data in route react
<Route path="/:name" component={Search} />
Example 2: passing data in route react
render={routeProps => <Search name={this.props.name} {...routeProps} />}
<Route path="/:name" component={Search} />
render={routeProps => <Search name={this.props.name} {...routeProps} />}