You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
389 B
13 lines
389 B
import { useEffect } from 'react';
|
|
import isBrowser from '../../isBrowser';
|
|
|
|
function useDocumentTitle(titleInfo, appDefaultTitle) {
|
|
var titleText = typeof titleInfo.pageName === 'string' ? titleInfo.title : appDefaultTitle;
|
|
useEffect(function () {
|
|
if (isBrowser() && titleText) {
|
|
document.title = titleText;
|
|
}
|
|
}, [titleInfo.title]);
|
|
}
|
|
|
|
export default useDocumentTitle; |