
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
async-reactor
Advanced tools
Render async Stateless Functional Components
npm install --save async-reactor
asyncReactor(component: Function, loader?: Component, error?: Component): Component
name | type | description |
---|---|---|
component | Function (async) | The async component you want to render |
loader (optionnal) | Component | Will be shown until the first component renders |
error (optionnal) | Component | Will be shown when an error occurred |
The returned value is a regular Component
.
This examples are exporting a regular React component. You can integrate it into an existing application or render it on the page.
See more examples here
import React from 'react'
import {asyncReactor} from 'async-reactor';
function Loader() {
return (
<b>Loading ...</b>
);
}
async function Time() {
const moment = await import('moment');
const time = moment();
return (
<div>
{time.format('MM-DD-YYYY')}
</div>
);
}
export default asyncReactor(Time, Loader);
import React from 'react';
import {asyncReactor} from 'async-reactor';
function Loader() {
return (
<h2>Loading ...</h2>
);
}
async function AsyncPosts() {
const data = await fetch('https://jsonplaceholder.typicode.com/posts');
const posts = await data.json();
return (
<ul>
{posts.map((x) => <li key={x.id}>{x.title}</li>)}
</ul>
);
}
export default asyncReactor(AsyncPosts, Loader);
FAQs
Render async Stateless Functional Components
The npm package async-reactor receives a total of 1,136 weekly downloads. As such, async-reactor popularity was classified as popular.
We found that async-reactor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.