render-app
Introduce
Provides commonly used hooks and utility functions for React.
Usage
npm i @x.render/render-app -S
Hooks
Many commonly used hooks are provided in render-app
usePageShow
usePageShow is used to execute related callback functions when the page is visible and invisible.
import { usePageShow } from "@x.render/render-app";
const Demo = () => {
const pageShow = () => {
console.log("Page not visible");
};
const pageHidden = () => {
console.log("Page visible");
};
usePageShow(pageShow, pageHidden);
return <div>demo</div>;
};
export default Demo;
the parameters executed by usePageShow are not required.