
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
react-asyncmodule-chunk
Advanced tools
react-asyncmodule's Provider.
npm install react-asyncmodule-chunk
该组件获取到当前匹配到的组件的 chunkName(就是上面 chunk 方法的返回) 和 getInitialData 组件上的静态方法,通常用于 server render。
import AsyncChunk from 'react-asyncmodule-chunk';
import { StaticRouter } from 'react-router';
import { renderToStaticMarkup } from 'react-dom/server';
const context = {};
const modules = [];
const saveModule = (module) => {
modules.push(module);
}
renderToStaticMarkup(
<StaticRouter
location={url}
context={context}
>
<AsyncChunk report={saveModule}>
<Approutes />
</AsyncChunk>
</StaticRouter>
);
// [{ chunkName: 'list', getInitialData: [Function] ]
如果你未使用任何第三方数据状态管理库(如redux),获取到数据后可通过 AsyncChunk 组件的 receiveData props传递数据至组件上。
module[0].getInitialData({ ctx.req }).then((data) => {
const html = renderToString(
<StaticRouter
location={url}
context={context}
>
<AsyncChunk receiveData={data}>
<Approutes />
</AsyncChunk>
</StaticRouter>
);
});
FAQs
react asyncmodule chunk
The npm package react-asyncmodule-chunk receives a total of 7 weekly downloads. As such, react-asyncmodule-chunk popularity was classified as not popular.
We found that react-asyncmodule-chunk 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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.