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 11import React from "react"
22
3- const getInitialState = ( ) => ( {
4- data : undefined ,
5- error : undefined ,
6- isLoading : false ,
7- startedAt : undefined ,
8- finishedAt : undefined
9- } )
10-
113/**
124 * createInstance allows you to create instances of Async that are bound to a specific promise.
135 * A unique instance also uses its own React context for better nesting capability.
146 */
157export const createInstance = ( defaultProps = { } ) => {
16- const { Consumer, Provider } = React . createContext ( getInitialState ( ) )
8+ const { Consumer, Provider } = React . createContext ( )
179
1810 class Async extends React . Component {
1911 mounted = false
2012 counter = 0
2113 args = [ ]
22- state = getInitialState ( )
14+ state = {
15+ data : undefined ,
16+ error : undefined ,
17+ isLoading : false ,
18+ startedAt : undefined ,
19+ finishedAt : undefined
20+ }
2321
2422 componentDidMount ( ) {
2523 this . mounted = true
You can’t perform that action at this time.
0 commit comments