UNPKG
@serpent/common-react
Version:
latest (1.0.3)
1.0.3
0.12.1
0.12.0
0.11.0
0.10.0
0.9.2
0.9.0
0.8.0
0.7.2
0.7.1
0.7.0
0.6.0
0.5.4
0.5.3
0.4.0
0.3.1
0.3.0
0.2.0
serpent react common package
github.com/qiu8310/serpent
qiu8310/serpent
@serpent/common-react
/
dist
/
hooks
/
useDocumentTitle.js
15 lines
(14 loc)
•
325 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import
{ useEffect }
from
'react'
;
/** * 修改页面标题 *
@param
title document title */
export
function
useDocumentTitle
(
title
) {
useEffect
(
function
(
) {
var
old =
document
.
title
;
document
.
title
= title;
return
function
(
) {
document
.
title
= old; }; }, [title]); }