I a bit new to react but trying to pass data from one page into another.
Page A:
const PlanAction = tw.div`px-4 sm:px-8 xl:px-16 py-8`;
const BuyNowButton = styled(PrimaryButtonBase)`
${tw`rounded-full uppercase tracking-wider py-4 w-full text-sm hover:shadow-xl transform hocus:translate-x-px hocus:-translate-y-px focus:shadow-outline`}
<PlanAction state={plan}>
<BuyNowButton css={!plan.featured && highlightGradientsCss[index]}
as="a" href="/payment" state={plan}
>
{primaryButtonText}
</BuyNowButton>
</PlanAction>
Page B:
const location = useLocation();
I used location but only pathname is present, the state is undefined. I tried for couple of hours but don't understand why the data is not pass in other page. Thank you