Easily check which prop is causing re-rendering your react component.
npm i check-re-render
import React, { Component } from "react";
import useWhichPropDidIt from "check-re-render";
const Example = (props) => {
useWhichPropDidIt("Count", props);
return <div>...</div>;
};
import { checkRenderCause } from "check-re-render";
componentDidUpdate(prevProps, prevState) {
checkRenderCause(prevProps, prevState, this.props, this.state)
}
;
MIT © navid-asgharzadeh