v6.0.35

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 '@asuikit/hooks';
import { Button } from '@asuikit/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;