File tree Expand file tree Collapse file tree 3 files changed +107
-199
lines changed Expand file tree Collapse file tree 3 files changed +107
-199
lines changed Original file line number Diff line number Diff line change 11import React from 'react'
2+ import PropTypes from 'prop-types'
23
34let titles = [ ]
45
@@ -16,27 +17,25 @@ export function flushTitle() {
1617 return title
1718}
1819
19- const { oneOfType, string, func } = React . PropTypes
20-
21- const Title = React . createClass ( {
22-
23- propTypes : {
24- render : oneOfType ( [ string , func ] ) . isRequired
25- } ,
26-
27- getInitialState ( ) {
28- return {
20+ class Title extends React . Component {
21+ constructor ( props ) {
22+ super ( props )
23+ this . state = {
2924 index : titles . push ( '' ) - 1
3025 }
31- } ,
26+ }
3227
3328 componentWillUnmount ( ) {
3429 titles . pop ( )
35- } ,
30+ }
3631
37- componentDidMount : updateTitle ,
32+ componentDidMount ( ) {
33+ updateTitle ( )
34+ }
3835
39- componentDidUpdate : updateTitle ,
36+ componentDidUpdate ( ) {
37+ updateTitle ( )
38+ }
4039
4140 render ( ) {
4241 const { render } = this . props
@@ -45,7 +44,11 @@ const Title = React.createClass({
4544 : render
4645 return this . props . children || null
4746 }
47+ }
4848
49- } )
49+ Title . propTypes = {
50+ render : PropTypes . string . isRequired
51+ }
5052
5153export default Title
54+
You can’t perform that action at this time.
0 commit comments