Skip to content

Commit 08a9c08

Browse files
gpooleljharb
andauthored
Revise rewording of jsx-no-bind rationale
Co-authored-by: Jordan Harband <ljharb@gmail.com>
1 parent e5acf3e commit 08a9c08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/rules/jsx-no-bind.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- end auto-generated rule header -->
44

5-
Using `bind` on a function or declaring a function in the render method of a component, and then passing that function as a prop will mean a brand new function is created on every single render. This can affect performance in some situations, as it may cause unnecessary re-renders if a brand new function is passed as a prop to a component that uses reference equality check on the prop to determine if it should update, such as a component wrapped with [`memo`](https://react.dev/reference/react/memo#memo).
5+
Using `bind` on a function or declaring a function in the render method of a component or the body of a functional component, and then passing that function as a prop will mean that the brand new function that is created on every single render will be considered a completely different function. This can affect performance in some situations, as it may cause unnecessary re-renders if a brand new function is passed as a prop to a component that uses reference equality check on the prop to determine if it should update, such as a component wrapped with [`memo`](https://react.dev/reference/react/memo#memo), or if the prop is used in any hook's "dependency array".
66

77
Note that this behavior is different for `ref` props, which is a special case in React that **does not** cause re-renders when a brand new function is passed. See [`ignore-refs`](#ignorerefs) below for more information.
88

0 commit comments

Comments
 (0)