
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-loading-screen-hoc
Advanced tools
An HOC function withLoadingScreen that makes any components to display as a page loading screen.
In Next.js, the hoc function is assumed to be passed a component that will be exported in _app.tsx.
Necessary types are included by default for TypeScript.
Compatible with Chrome, FireFox, Safari, Edge, IE11.
npm i -S react-loading-screen-hoc
function withLoadingScreen<CP>(
// a component that will be wrapped.
ChildrenComponent: React.ComponentType<CP>,
// a component thet will be displayed as a loading screen.
LoadingScreenComponent: LoadingScreenComponentType,
// configurations
config?: LoadingScreenConfig
): React.ComponentType<CP>;
See dist/index.d.ts for full declarations.
import withLoadingScreen from "react-loading-screen-hoc";
const LoadingScreenComponent = (props: { isLoaded: boolean }) => {
const className = props.isLoaded ? "loaded" : "";
return <div className={className}> ~~~ </div>;
};
const MainComponent = () => {
/* ~~~ */
};
export default withLoadingScreen(MainComponent, LoadingScreenComponent, {
/* config if needed */
});
That's it!
LoadingScreenComponent has only one constraint of props that needs to have isLoaded property.
MainComponent also be passed optional isLoaded props.withLoadingScreen displays LoadingScreenComponent while loading page.
isLoaded will change to true when finishing loading so that you can control LoadingScreenComponent freely as you want.examples/loading-screen-component.tsx.document.readyState and window.addEventListener("load", ~~~) to validate whether a page finishes loading.LoadingScreenComponent.import React from "react";
import type { AppProps } from "next/app";
import withLoadingScreen from "next-loading-screen";
import { LoadingScreenComponent } from "path/to/loading-screen-component.tsx";
function CustomApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
export default withLoadingScreen(CustomApp, LoadingScreenComponent, {
limitMilliSecond: 10 * 1000,
});
FAQs
A loading screen hoc for React
We found that react-loading-screen-hoc 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

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.