From 97788eff86d1869d76e8750eaef44366166424fb Mon Sep 17 00:00:00 2001 From: "Rayyan (Rayy)" Date: Wed, 15 Nov 2023 05:30:45 +0000 Subject: [PATCH] Why won't you just grab data from the fucking database --- src/pages/Detail.js | 10 +++++++--- src/pages/Signup.js | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pages/Detail.js b/src/pages/Detail.js index 9535139..410e8fe 100644 --- a/src/pages/Detail.js +++ b/src/pages/Detail.js @@ -13,10 +13,14 @@ export function Detail(props) { let { id } = useParams(); useEffect(() => { - if (!movieData) { - props.handler(id).then((movie) => setMovieData(movie)) + if (!movieData && typeof props.handler === 'function') { + const fetchMovieData = async () => { + const movieData = await props.handler(id); + setMovieData(movieData); + }; + fetchMovieData(); } - }, [id]); + }, [id, movieData, props.handler]); if (movieData) { return ( diff --git a/src/pages/Signup.js b/src/pages/Signup.js index 256fe97..1e159c4 100644 --- a/src/pages/Signup.js +++ b/src/pages/Signup.js @@ -46,6 +46,7 @@ export function Signup ( props ) { } else { setValidemail(false) + } }, [useremail]) @@ -58,6 +59,8 @@ export function Signup ( props ) { } }, [userpassword]) + + return ( @@ -103,4 +106,4 @@ export function Signup ( props ) { ) - } + } \ No newline at end of file