Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marvinhagemeister/preact-loadable
Tiny preact component for async tasks
https://github.com/marvinhagemeister/preact-loadable
async loadable preact
Last synced: 10 days ago
JSON representation
Tiny preact component for async tasks
- Host: GitHub
- URL: https://github.com/marvinhagemeister/preact-loadable
- Owner: marvinhagemeister
- License: mit
- Created: 2017-10-31T07:09:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-20T10:00:55.000Z (about 7 years ago)
- Last Synced: 2025-01-08T11:04:12.561Z (15 days ago)
- Topics: async, loadable, preact
- Language: TypeScript
- Size: 36.1 KB
- Stars: 24
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-list - preact-loadable
README
# Preact Loadable
A simple component to display the promise state of a promise returning function
or any other async task.## Installation
```bash
# npm
npm install --save preact preact-loadable# yarn
yarn add preact preact-loadable
```## Usage
```jsx
import { h } from "preact";
import Loadable from "preact-loadable";function MyComponent() {
return;
import("../MyOtherComponent").then(m => m.default())}
error={err => "Oops, an error occurred: " + err.message}
loading={() => "Loading..."}
success={result => doSomething(result)}
/>
}
```## License
`MIT`, see [License file](LICENSE.md).