Fazza Razaq Amiarso• 2,340
@fazzaamiarso
Posted
Hi @ansman58! Great job on finishing the project!
I have some suggestions for you
- Currently you are navigating by rendering component conditionally with State. I recommend you to use a routing library instead. The most popular is React Router
- In your Crew page, rather than using
useEffect
to find the selected crew, you can achieve the same result by doing it in render. Example:
// by doing this, you don't need `data` state anymore
const { crewMember, setCrewMember } = React.useContext(CurrentNavContext);
// this will be re-calculated everytime `crewMember` changes.
const crewInfo = crew.find((item) => item.role === crewMember) ?? null;
<Section
subtitle={crewInfo?.role}
title={crewInfo?.name as string}
description={crewInfo?.bio as string}
titleClass={style.sectionTitle}
subtitleClass={style.sectionSubtitle}
/>
I hope it helps! Cheers!
0