From 16e1e0ee708a854ab90acea1110bfda57ccbf9a8 Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Sat, 18 Jan 2025 01:34:45 +0530 Subject: [PATCH 1/2] fix: Fix Loading Hero Section Problem - update Hero component to use hero dependency in useEffect and adjust heading styles --- src/components/homeComponents/Hero.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/homeComponents/Hero.jsx b/src/components/homeComponents/Hero.jsx index 27b598f..96f8e8b 100644 --- a/src/components/homeComponents/Hero.jsx +++ b/src/components/homeComponents/Hero.jsx @@ -32,7 +32,7 @@ const Hero = () => { setHeading(data.homeTitle); setParagraph(data.homeParagraph); } - }, []); + }, [hero]); return !hero ? ( @@ -43,8 +43,9 @@ const Hero = () => { backgroundImage: `url(${image})`, }} > +
-

+

{heading}

From 76db9513fbe941cbe0da9033268daee683f394bd Mon Sep 17 00:00:00 2001 From: LazyCodwr Date: Sat, 18 Jan 2025 22:26:35 +0530 Subject: [PATCH 2/2] feat: Enhance AboutHero component with dynamic content - Implemented useState and useEffect hooks to manage and display dynamic content for image, heading, and paragraph from the Redux store. - Updated the AboutHero component to render the fetched data instead of hardcoded values, improving maintainability and flexibility. --- src/components/aboutComponents/AboutHero.jsx | 31 ++++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/components/aboutComponents/AboutHero.jsx b/src/components/aboutComponents/AboutHero.jsx index b9630fc..e19af87 100644 --- a/src/components/aboutComponents/AboutHero.jsx +++ b/src/components/aboutComponents/AboutHero.jsx @@ -7,10 +7,25 @@ import Loader from '../Loader'; import { useSelector } from 'react-redux'; const AboutHero = () => { + +const [image, setimage] = useState('') +const [para, setpara] = useState('') +const [heading, setheading] = useState('') + let about = useSelector( state => state.about.aboutPage, ); + + useEffect(()=>{ + + if(about){ + setimage(about.AboutHero.image) + setpara(about.AboutHero.paragraph) + setheading(about.AboutHero.Heading) + } + + },[about]) return !about ? ( ) : ( @@ -18,26 +33,16 @@ const AboutHero = () => {

- Let’s learn about new - Knowledge and abitlites + {heading}

- Welcome to [Institute Name], - an institution dedicated to - fostering innovation, - knowledge, and personal - growth. Our mission is to - shape tomorrow’s leaders by - offering exceptional - educational opportunities - and encouraging intellectual - exploration. + {para }