useLifecycleLogger
Aboutβ
A react hook that console logs parameters as component transitions through lifecycles.
Installationβ
npm install rooks
Importing the hookβ
import { useLifecycleLogger } from "rooks";
Usageβ
function Demo(props) {
useLifecycleLogger("Demo", props);
// it will props log on mount, update and unmount
return null;
}
render(<Demo />);
Argumentsβ
Argument value | Type | Description | Defualt |
---|---|---|---|
componentName | String | The name of component to be shown in the log | "Component" |
rest | Array | An arry of variables to be logged in component lifecycle | undefined |
Returnsβ
No return value
Codesandbox Examplesβ
Basic Usageβ
Join Bhargav's discord serverβ
You can click on the floating discord icon at the bottom right of the screen and talk to us in our server.