Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const defaultPageTitleRender = (pageProps: GetPageTitleProps, props: BasicLayoutProps): string => {
const { pageTitleRender } = props;
if (pageTitleRender === false) {
return props.title || '';
}
if (pageTitleRender) {
const title = pageTitleRender(pageProps);
if (typeof title === 'string') {
return title;
}
warning(
typeof title === 'string',
'pro-layout: renderPageTitle return value should be a string',
);
}
return defaultGetPageTitle(pageProps);
};