i have a MainComponent and ChildComponent and pass isOpen prop from MainComponent to ChildComponent.
Below is the code,
function MainComponent () {
return (
<Route
path="items"
render={routeProps => (
<Layout>
<ChildComponent
isOpen={isOpen}// passing prop here
{...routeProps}
/>
</Layout>
)}
/>
)
}
type Props = RouteComponentProps<{ first: string, second: string }>;
function SchedulePage({ match }: Props) { //how can i access it here
const { first } = match.params;
}
I have tried something like below
type Props = RouteComponentProps<{ first: string; second: string, isOpen: boolean }>;
function ChildComponent({ isOpen, match }: Props) {
const { first } = match.params;
}
But this doesnt seem to be correct. any ideas on how to fix this. thanks.