@shopify/react-async
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -7,2 +7,3 @@ import * as React from 'react'; | ||
defer?: DeferTiming; | ||
renderLoading?(): React.ReactNode; | ||
} | ||
@@ -9,0 +10,0 @@ interface Props<Value> extends LoadProps<Value>, AsyncPropsRuntime { |
{ | ||
"name": "@shopify/react-async", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Tools for creating powerful, asynchronously-loaded React components.", |
@@ -127,4 +127,10 @@ # `@shopify/react-async` | ||
If you need to customize the deferring behaviour at runtime, the library always allows you to pass an `async` prop with some custom options for the underlying `<Async />` loader component (**note**: this library reserves the `async` prop name, so you can’t use that name for any of your component’s own props, or for the props you specify in the `renderPreload`, `renderPrefetch`, or `renderKeepFresh` options). | ||
#### Overwriting properties | ||
The library always allows you to pass an `async` prop with some custom options for the underlying `<Async />` loader component (**note**: this library reserves the `async` prop name, so you can’t use that name for any of your component’s own props, or for the props you specify in the `renderPreload`, `renderPrefetch`, or `renderKeepFresh` options). | ||
Currenty the library allows you to overwite two properties: | ||
##### `defer?: DeferTiming` | ||
```tsx | ||
@@ -157,2 +163,17 @@ import {createAsyncComponent, DeferTiming} from '@shopify/react-async'; | ||
##### `renderLoading?(): React.ReactNode` | ||
```tsx | ||
import {createAsyncComponent} from '@shopify/react-async'; | ||
import {Spinner} from '@shopify/polaris'; | ||
// No loading state | ||
const MyComponent = createAsyncComponent({ | ||
load: () => import('./MyComponent'), | ||
}); | ||
// But this instance will render <Spinner /> as its loading state | ||
<MyComponent async={{renderLoading: () => <Spinner />}} />; | ||
``` | ||
### `PrefetchRoute` and `Prefetcher` | ||
@@ -159,0 +180,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41148
619
260