react-prop-log
A simple React performance and debugging helper. Drop into a component and monitor props changes in the console.
Installation
npm i --save-dev react-prop-log
Usage
propLog
is a function that'll wrap a component and log any props changes whenever the componentDidUpdate
lifecycle method executes. propLog
is a higher-order component (HOC) so you'll add it similarly to Redux's connect
.
;/* -- Your component code here -- */YourComponentName;
To ensure you see all props changes when debugging, make sure propLog
is the innermost function if your component is nested in multiple HOCs.
// do this; // not this;
logChangedProps
is the actual logger, and can be imported separately for greater control on where in the React lifecycle it is triggered. It expects a new set of props & your component instance.
; Component /* -- Your component code here -- */ { ; } /* -- Your component code here -- */ ;
Development
See CONTRIBUTING for information on working with the codebase.