Discord
Source code

use-logger

Log given values to console when component renders
Import

Usage

Hook 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;
Build fully functional accessible web applications with ease
Feedback
Your feedback is most valuable contribution to the project, please share how you use Mantine, what features are missing and what is done good
Leave feedback