diff --git a/src/App.js b/src/App.js
index 8dfa97f..286e0cd 100644
--- a/src/App.js
+++ b/src/App.js
@@ -5,11 +5,14 @@ import NavBar from './components/NavBar';
import Footer from './components/Footer';
import ProductDetail from './components/ProductDetail';
import Carousel from './components/Carousel';
+
function App (props) {
var products = props.state.products.map(function(prod){
return ;
});
+ console.log("Products:",products);
+
return (
diff --git a/src/components/ProductDetail.js b/src/components/ProductDetail.js
index 885919a..7b28023 100644
--- a/src/components/ProductDetail.js
+++ b/src/components/ProductDetail.js
@@ -1,7 +1,8 @@
import React from "react";
+import Reviews from "./Reviews"
function ProductDetail(props) {
- const {name,description,rating,imgUrl} = props.product;
+ const {name,description,rating,imgUrl,reviews} = props.product;
const stars = [];
for (let i = 0; i < rating; i++) {
stars.push(
);
@@ -14,11 +15,11 @@ function ProductDetail(props) {
-
{description}
+
{description}
-
15 reviews
+
{stars}
diff --git a/src/components/Reviews.js b/src/components/Reviews.js
new file mode 100644
index 0000000..eda1dfb
--- /dev/null
+++ b/src/components/Reviews.js
@@ -0,0 +1,35 @@
+import React, { Component } from 'react';
+//props passed to class component via "this.props"
+ class Reviews extends Component {
+ state = {showing: false};
+
+ render(){
+ let firstReview;
+ if (this.state.showing) {
+ firstReview = {this.props.numberOfReviews[0].description}
;
+ } else {
+ firstReview = ;
+ }
+
+ return(
+
+
+ {firstReview}
+
+ )
+ }
+}
+
+export default Reviews;
diff --git a/src/state.js b/src/state.js
index badf378..c5a5fb3 100644
--- a/src/state.js
+++ b/src/state.js
@@ -10,7 +10,7 @@ export default {
"price": "$95.11",
"category": "food",
"reviews": [{
- "description": "architect revolutionary deliverables",
+ "description": "Aarchitect revolutionary deliverables",
"rating": 2
}, {
"description": "orchestrate dynamic schemas",
@@ -50,7 +50,7 @@ export default {
"price": "$37.09",
"category": "food",
"reviews": [{
- "description": "architect revolutionary deliverables",
+ "description": "Barchitect revolutionary deliverables",
"rating": 2
}, {
"description": "orchestrate dynamic schemas",
@@ -76,7 +76,7 @@ export default {
"price": "$51.83",
"category": "food",
"reviews": [{
- "description": "architect revolutionary deliverables",
+ "description": "Carchitect revolutionary deliverables",
"rating": 2
}, {
"description": "orchestrate dynamic schemas",
@@ -221,4 +221,4 @@ export default {
}
]
}]
-}
\ No newline at end of file
+}