File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
3
- const getInitialState = ( ) => ( {
4
- data : undefined ,
5
- error : undefined ,
6
- isLoading : false ,
7
- startedAt : undefined ,
8
- finishedAt : undefined
9
- } )
10
-
11
3
/**
12
4
* createInstance allows you to create instances of Async that are bound to a specific promise.
13
5
* A unique instance also uses its own React context for better nesting capability.
14
6
*/
15
7
export const createInstance = ( defaultProps = { } ) => {
16
- const { Consumer, Provider } = React . createContext ( getInitialState ( ) )
8
+ const { Consumer, Provider } = React . createContext ( )
17
9
18
10
class Async extends React . Component {
19
11
mounted = false
20
12
counter = 0
21
13
args = [ ]
22
- state = getInitialState ( )
14
+ state = {
15
+ data : undefined ,
16
+ error : undefined ,
17
+ isLoading : false ,
18
+ startedAt : undefined ,
19
+ finishedAt : undefined
20
+ }
23
21
24
22
componentDidMount ( ) {
25
23
this . mounted = true
You can’t perform that action at this time.
0 commit comments