@@ -11,7 +11,7 @@ const renderFn = (children, ...args) =>
1111 * @prop {Object } state React Async state object
1212 * @prop {boolean } persist Show until we have data, even while pending (loading) or when an error occurred
1313 */
14- export const Initial = ( { children, persist, state } ) =>
14+ export const Initial = ( { children, persist, state = { } } ) =>
1515 state . isInitial || ( persist && ! state . data ) ? renderFn ( children , state ) : null
1616
1717/**
@@ -21,7 +21,7 @@ export const Initial = ({ children, persist, state }) =>
2121 * @prop {Object } state React Async state object
2222 * @prop {boolean } initial Show only on initial load (data is undefined)
2323 */
24- export const Pending = ( { children, initial, state } ) =>
24+ export const Pending = ( { children, initial, state = { } } ) =>
2525 state . isPending && ( ! initial || ! state . value ) ? renderFn ( children , state ) : null
2626
2727/**
@@ -31,7 +31,7 @@ export const Pending = ({ children, initial, state }) =>
3131 * @prop {Object } state React Async state object
3232 * @prop {boolean } persist Show old data while pending (promise is loading)
3333 */
34- export const Fulfilled = ( { children, persist, state } ) =>
34+ export const Fulfilled = ( { children, persist, state = { } } ) =>
3535 state . isFulfilled || ( persist && state . data ) ? renderFn ( children , state . data , state ) : null
3636
3737/**
@@ -41,7 +41,7 @@ export const Fulfilled = ({ children, persist, state }) =>
4141 * @prop {Object } state React Async state object
4242 * @prop {boolean } persist Show old error while pending (promise is loading)
4343 */
44- export const Rejected = ( { children, persist, state } ) =>
44+ export const Rejected = ( { children, persist, state = { } } ) =>
4545 state . isRejected || ( persist && state . error ) ? renderFn ( children , state . error , state ) : null
4646
4747/**
@@ -51,7 +51,7 @@ export const Rejected = ({ children, persist, state }) =>
5151 * @prop {Object } state React Async state object
5252 * @prop {boolean } persist Show old data or error while pending (promise is loading)
5353 */
54- export const Settled = ( { children, persist, state } ) =>
54+ export const Settled = ( { children, persist, state = { } } ) =>
5555 state . isSettled || ( persist && state . value ) ? renderFn ( children , state ) : null
5656
5757if ( propTypes ) {
0 commit comments