Created
August 6, 2018 04:43
-
-
Save Joe1220/1672ceda5628466882680f07de2aebbf to your computer and use it in GitHub Desktop.
App.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import { Route, Switch } from "react-router-dom"; | |
import Nav from "components/Nav/Nav"; | |
import Cart from "components/Cart/Cart"; | |
import Main from "components/Main/Main"; | |
import data from "MOCK_DATA.json"; | |
class App extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
products: data | |
}; | |
}; | |
componentDidMount() { | |
console.log(this.state.products) | |
}; | |
render() { | |
return ( | |
<Routes /> | |
); | |
}; | |
}; | |
const Routes = props => ( | |
<div> | |
<Nav /> | |
<Switch> | |
<Route exact path="/" component={Main} /> | |
<Route exact path="/cart" component={Cart} /> | |
</Switch> | |
</div> | |
); | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment