All Projects → alexeyraspopov → React Coroutine

alexeyraspopov / React Coroutine

Licence: mit
Make your async components compact and descriptive by leveraging the power of the language features

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Coroutine

Kotlinx.coroutines
Library support for Kotlin coroutines
Stars: ✭ 10,194 (+4043.9%)
Mutual labels:  async, coroutines
Cppcoro
A library of C++ coroutine abstractions for the coroutines TS
Stars: ✭ 2,118 (+760.98%)
Mutual labels:  async, coroutines
Coroutines
A simple system for running nested coroutines in C#.
Stars: ✭ 100 (-59.35%)
Mutual labels:  async, coroutines
Ktx
LibKTX: Kotlin extensions for LibGDX games and applications
Stars: ✭ 913 (+271.14%)
Mutual labels:  async, coroutines
Minicoro
Single header asymmetric stackful cross-platform coroutine library in pure C.
Stars: ✭ 164 (-33.33%)
Mutual labels:  async, coroutines
Handle Path Oz
Android Library to handle multiple Uri's(paths) received through Intents.
Stars: ✭ 36 (-85.37%)
Mutual labels:  async, coroutines
Mioco
[no longer maintained] Scalable, coroutine-based, fibers/green-threads for Rust. (aka MIO COroutines).
Stars: ✭ 125 (-49.19%)
Mutual labels:  async, coroutines
Recoil
Asynchronous coroutines for PHP 7.
Stars: ✭ 765 (+210.98%)
Mutual labels:  async, coroutines
Vue Concurrency
A library for encapsulating asynchronous operations and managing concurrency for Vue and Composition API.
Stars: ✭ 147 (-40.24%)
Mutual labels:  async, generators
Unityfx.async
Asynchronous operations (promises) for Unity3d.
Stars: ✭ 143 (-41.87%)
Mutual labels:  async, coroutines
May
rust stackful coroutine library
Stars: ✭ 909 (+269.51%)
Mutual labels:  async, coroutines
Taskr
A fast, concurrency-focused task automation tool.
Stars: ✭ 2,421 (+884.15%)
Mutual labels:  coroutines, generators
Runtimepermission
Simpliest way to ask runtime permissions on Android, no need to extend class or override permissionResult method, choose your way : Kotlin / Coroutines / RxJava / Java7 / Java8
Stars: ✭ 860 (+249.59%)
Mutual labels:  async, coroutines
Tascalate Async Await
Async / Await asynchronous programming model for Java similar to the functionality available in C# 5. The implementation is based on continuations for Java (see my other projects).
Stars: ✭ 60 (-75.61%)
Mutual labels:  async, coroutines
Kotlin Coroutines Retrofit
Kotlin Coroutines await() extension for Retrofit Call
Stars: ✭ 812 (+230.08%)
Mutual labels:  async, coroutines
Tina
Tina is a teeny tiny, header only, coroutine and job library.
Stars: ✭ 125 (-49.19%)
Mutual labels:  async, coroutines
Groupco
PHP的服务化框架。适用于Api、Http Server、Rpc Server;帮助原生PHP项目转向微服务化。出色的性能与支持高并发的协程相结合
Stars: ✭ 473 (+92.28%)
Mutual labels:  async, coroutines
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+180.49%)
Mutual labels:  async, coroutines
Asynquence
Asynchronous flow control (promises, generators, observables, CSP, etc)
Stars: ✭ 1,737 (+606.1%)
Mutual labels:  async, generators
Fooproxy
稳健高效的评分制-针对性- IP代理池 + API服务,可以自己插入采集器进行代理IP的爬取,针对你的爬虫的一个或多个目标网站分别生成有效的IP代理数据库,支持MongoDB 4.0 使用 Python3.7(Scored IP proxy pool ,customise proxy data crawler can be added anytime)
Stars: ✭ 195 (-20.73%)
Mutual labels:  async, coroutines

React Coroutine

npm install react-coroutine

Coroutines are computer program components that generalize subroutines for nonpreemptive multitasking, by allowing multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks, exceptions, event loop, iterators, infinite lists and pipes.
Wikipedia

Describe complex async state flows in your React components using only language features like generators, async functions, and async generators.

No API or new abstractions to learn, only JavaScript code as it intended to be.

Motivation

React Coroutine attempts to use basic and known language features for the sake of solving problems that are usually solved with APIs and new abstractions that require particular knowledge about them or, sometimes, about internal processes.

Examples

import React from 'react';
import Coroutine from 'react-coroutine';
async function UserListContainer() {
  try {
    // Wait for async data and render it in the same way as plain components
    let users = await Users.retrieve();
    return <UserList users={users} />;
  } catch (error) {
    // Handle failures in place with just JavaScript tools
    return <ErrorMessage error={error} />;
  }
}

export default Coroutine.create(UserListContainer);
async function* PokemonInfoPage({ pokemonId, pokemonName }) {
  // Use generators to provide multiple render points of your async component
  yield <p>Loading {pokemonName} info...</p>;

  // Easily import components asynchronously and render them on demand
  let { default: PokemonInfo } = await import('./PokemonInfo.react');
  let data = await PokemonAPI.retrieve(pokemonId);

  return <PokemonInfo data={data} />;
}

export default Coroutine.create(PokemonInfoPage);
function* MovieInfoLoader({ movieId }) {
  // Assuming cache.read() return a value from cache or Promise
  let movieData = yield movieCache.read(movieId);
  return <MovieInfo data={movieData} />;
}

export default Coroutine.create(MovieInfoLoader);

Documentation

See details page for more.

Installation

React Coroutine project is available as the react-coroutine package on NPM. Installed package includes precompiled code (ECMAScript 5), ES Modules-friendly artifact, LICENSE, and the changelog.

Contributing

Current project has adopted a Code of Conduct which is expected to be adhered by project participants. Please also visit the document website to learn more.

Please read the contributing guide to learn how to propose bug fixes and improvements, and how to build and test your changes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].