shallow-compare-without-functions

Shallow compare for React components where functions are excluded

Usage no npm install needed!

<script type="module">
  import shallowCompareWithoutFunctions from 'https://cdn.skypack.dev/shallow-compare-without-functions';
</script>

README

shallow-compare-without-functions

Travis

Just like React addons shallowCompare except it ignores functions. It's not uncommon to want to bind to a instance function or wrap and action creator. The problem with doing this is that even if the value props don't change, using a new function will trigger a re-render, making it a bad idea to use shallowCompare in that case. Additionally, the actual behavior of those functions almost never changes.

See this demo for an example.