Skip to content

Instantly share code, notes, and snippets.

@ovpv

ovpv/app.js

Created Aug 7, 2019
Embed
What would you like to do?
Router switch for rendering page components
import React, { Component, Fragment } from "react";
import { Switch, Route } from "react-router-dom";
import Routes from "../routes";
import Header from "./components/header/header";
export default class App extends Component {
render() {
return (
<Fragment>
<Header />
<Switch>
{Routes.map((c, index) => (
<Route key={index} path={c.url} exact component={c.component} />
))}
</Switch>
</Fragment>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment