Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thaddeusjiang/react-promise-data

Don't wrong again about "isLoading? 🔄 : isError ? ❌ : 👍"
https://github.com/thaddeusjiang/react-promise-data

promise reactjs

Last synced: 21 days ago
JSON representation

Don't wrong again about "isLoading? 🔄 : isError ? ❌ : 👍"

Awesome Lists containing this project

README

        

Welcome to @thaddeusjiang/react-promise-data 👋




Version


Documentation


Maintenance


License: MIT


Twitter: ThaddeusJiang

> Don't wrong again about "isLoading? 🔄 : isError ? ❌ : 👍"

## Features

- [x] isLoading? 🔄 : isError ? ❌ : 👍

## Install

```sh
yarn add @thaddeusjiang/react-promise-data
```

## Usage

```js
export const DefaultLoading = () => {
return (

{({ data }) =>

{data}
}

);
};

export const DefaultError = () => {
return (

{({ data }) =>

{data}
}

);
};

export const DefaultData = () => {
return (

{({ data }) =>

{data}
}

);
};

export const CustomLoading = () => {
return (

🔄 Custom Loading...
}
>
{({ data }) =>
{data}
}

);
};

export const CustomError = () => {
return (

💥 Custom Error: {error}
}
>
{({ data }) =>
{data}
}

);
};
```

## Development
### Storybook

Run inside another terminal:

```bash
yarn storybook
```

### Example

Then run the example inside another:

```bash
yarn link

cd example
yarn link "@thaddeusjiang/react-promise-data"
yarn # or yarn to install dependencies
yarn start #

```

### Run tests

```sh
yarn test
```

## Author

👤 **Thaddeus Jiang**

* Website: https://thaddeusjiang.com/
* Twitter: [@ThaddeusJiang](https://twitter.com/ThaddeusJiang)
* Github: [@ThaddeusJiang](https://github.com/ThaddeusJiang)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/ThaddeusJiang/react-promise-data/issues). You can also take a look at the [contributing guide](https://github.com/ThaddeusJiang/react-promise-data/blob/main/CONTRIBUTING.md).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2022 [Thaddeus Jiang](https://github.com/ThaddeusJiang).

This project is [MIT](https://github.com/ThaddeusJiang/react-promise-data/blob/main/LICENSE) licensed.

***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_