Default values
You can use destructuring and assignment to specify default values on props
interface LayoutProps {
withBackButton: boolean
}
function Layout({withBackButton = false, children}: LayoutProps) {
return (
<View>
{withBackButton && <BackButton />}
{children}
</View>
);
}
Subscribe?
Be the first to receive insightful articles and actionable resources that help you to elevate your skills.