Skip to content

Commit 60578af

Browse files
committed
Minor change to static props on provider.
1 parent 829f834 commit 60578af

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/AsyncComponentProvider.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,6 @@ import PropTypes from 'prop-types'
44
import createAsyncContext from './createAsyncContext'
55

66
class AsyncComponentProvider extends React.Component {
7-
static propTypes = {
8-
children: PropTypes.node.isRequired,
9-
asyncContext: PropTypes.shape({
10-
getNextId: PropTypes.func.isRequired,
11-
resolved: PropTypes.func.isRequired,
12-
getState: PropTypes.func.isRequired,
13-
}),
14-
rehydrateState: PropTypes.shape({
15-
resolved: PropTypes.object,
16-
}),
17-
}
18-
19-
static defaultProps = {
20-
asyncContext: undefined,
21-
rehydrateState: {
22-
resolved: {},
23-
},
24-
}
25-
26-
static childContextTypes = {
27-
asyncComponents: PropTypes.shape({
28-
getNextId: PropTypes.func.isRequired,
29-
resolved: PropTypes.func.isRequired,
30-
shouldRehydrate: PropTypes.func.isRequired,
31-
}).isRequired,
32-
}
33-
347
componentWillMount() {
358
this.asyncContext = this.props.asyncContext || createAsyncContext()
369
this.rehydrateState = this.props.rehydrateState
@@ -55,4 +28,31 @@ class AsyncComponentProvider extends React.Component {
5528
}
5629
}
5730

31+
AsyncComponentProvider.propTypes = {
32+
children: PropTypes.node.isRequired,
33+
asyncContext: PropTypes.shape({
34+
getNextId: PropTypes.func.isRequired,
35+
resolved: PropTypes.func.isRequired,
36+
getState: PropTypes.func.isRequired,
37+
}),
38+
rehydrateState: PropTypes.shape({
39+
resolved: PropTypes.object,
40+
}),
41+
}
42+
43+
AsyncComponentProvider.defaultProps = {
44+
asyncContext: undefined,
45+
rehydrateState: {
46+
resolved: {},
47+
},
48+
}
49+
50+
AsyncComponentProvider.childContextTypes = {
51+
asyncComponents: PropTypes.shape({
52+
getNextId: PropTypes.func.isRequired,
53+
resolved: PropTypes.func.isRequired,
54+
shouldRehydrate: PropTypes.func.isRequired,
55+
}).isRequired,
56+
}
57+
5858
export default AsyncComponentProvider

0 commit comments

Comments
 (0)