useLifecycleLogger

About

A react hook that console logs parameters as component transitions through lifecycles.

Installation

Examples

import "./styles.css";
import { useLifecycleLogger } from "rooks";
import { useEffect, useState } from "react";

export default function App() {
  const [value, setValue] = useState(0);

  useEffect(() => {
    setValue(1);
  }, []);

  useLifecycleLogger("Demo", value);

  return (
    <div className="App">
      <h1>useLifecycleLogger example</h1>
      <h2>See console for logs</h2>
    </div>
  );
}

Arguments

Argument valueTypeDescriptionDefualt
componentNameStringThe name of component to be shown in the log"Component"
restArrayAn arry of variables to be logged in component lifecycleundefined

Returns

No return value

Join the community!

Join our discord server! You can click the floating discord icon at the bottom right of the screen and chat with us!

Powered by vercel