Skip to content

๐Ÿ“ Helps you debug React components by logging props changes

License

Notifications You must be signed in to change notification settings

Danilqa/react-props-diff-logger

Repository files navigation

react props diff logger

Helps you debug React components by logging props changes.

Installation

npm install -D react-props-diff-logger
yarn add --dev react-props-diff-logger
pnpm add -D react-props-diff-logger

Usage

Basic Usage

Wrap your component with withPropsDiffLogger HOC:

import { PropsDiffLogger } from 'react-props-diff-logger';
import { MyComponent as _MyComponent } from '../../components/my-component'; 

const MyComponent = withPropsDiffLogger(_MyComponent);

function App() {
  return (
    // ...
      <MyComponent />
    // ...
  );
}

Usage with Memoized Components

If you have a memoized component, you should wrap withPropsDiffLogger with memo in the same way:

const MyComponent = memo(withPropsDiffLogger(_MyComponent), /*arePropsEqual?*/);

Name

By default, the function's name or displayName is used. To set or override the component's name, provide the second name argument:

const MyComponent = withPropsDiffLogger(_MyComponent, 'MyCustomName');

Support the project by giving it a star! โญ

About

๐Ÿ“ Helps you debug React components by logging props changes

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published