use-logger

Log given values to console when component renders
Import

Usage

use-logger logs given values to console each time component renders, do not use in production. Open devtools to see state changes in console:

import { useState } from 'react';
import { useLogger } from '@mantine/hooks';
import { Button } from '@mantine/core';
function Demo() {
const [count, setCount] = useState(0);
useLogger('Demo', [{ count, hello: 'world' }]);
return <Button onClick={() => setCount((c) => c + 1)}>Update state ({count})</Button>;
}

Definition

function useLogger(componentName: string, props: any[]): any;