New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-trace-update

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-trace-update

Tracing prop updates in a React component

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

react-trace-update

Tracing prop updates in a React component

License NPM Version Known Vulnerabilities NPM Downloads

Usage

useTraceUpdate

function MyComponent(props) {
    useTraceUpdate(props);
    return <div>Hello World!</div>;
}

Call the useTraceUpdate hook inside your functional component and pass in the props object.
Whenever the component is re-rendered, the hook will log the changed props to the console.

withTraceUpdate

const WithTraceUpdate = withTraceUpdate(({ count }) => <div>{count}</div>, {
    onUpdate(props) {
        console.log("WithTraceUpdate props updated", props);
    },
});

withTraceUpdate allows you to wrap a component and automatically apply the useTraceUpdate hook to it.

Options

PropertyTyperequiredDescription
onUpdate(changedProps: Partial<Record<keyof T, [any, any]>>) => voidfalseA callback function that is called when props change. It receives the changed props as an argument.

FAQs

Package last updated on 16 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts