Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 24, 2018 13:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Youtube in React: wiring up Search component with react-router
import Search from './containers/Search/Search';
/* ... */
class App extends Component {
render() {
return (
<AppLayout>
<Switch>
<Route path="/feed/trending" component={Trending}/>
<Route path="/results" render={() => <Search key={this.props.location.key}/>}/>
<Route path="/watch" render={() => <Watch key={this.props.location.key}/>}/>
<Route path="/" component={Home}/>
</Switch>
</AppLayout>
);
}
/* ... */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment