From 3b7285b1a80305f5bf6fbda29d86fe5267ec5979 Mon Sep 17 00:00:00 2001 From: "Rayyan (Rayy)" Date: Tue, 21 Nov 2023 10:11:14 +0000 Subject: [PATCH] Further changes to the ReviewForm to add authentication state --- src/components/ReviewForm.js | 15 +++++++++++---- src/pages/Detail.js | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/ReviewForm.js b/src/components/ReviewForm.js index 9999228..36a139c 100644 --- a/src/components/ReviewForm.js +++ b/src/components/ReviewForm.js @@ -2,24 +2,31 @@ import Form from "react-bootstrap/Form" import Button from "react-bootstrap/Button" import { AuthContext } from "../contexts/AuthContext" -import { useContext } from "react" +import { useContext, useState } from "react" +const submitHandler = (event) => { +event.preventDefault() +} export function ReviewForm(props) { const auth = useContext(AuthContext) + const[star, setStar ] = useState() + const[title, setTitle ] = useState() + const[review, setReview ] = useState() if (auth) { return ( -
-

Review this movie

+ +

Review {props.movietitle}

Star - + setStar(evt.target.value) }> + You have given {star} star(s) Title diff --git a/src/pages/Detail.js b/src/pages/Detail.js index 40baa38..167966b 100644 --- a/src/pages/Detail.js +++ b/src/pages/Detail.js @@ -24,7 +24,7 @@ export function Detail(props) { -

{movieData.title}

+

{movieData.movie_title}

@@ -50,7 +50,7 @@ export function Detail(props) { - +