After reading through the style guide I discovered something small in the following section.
The suggested format above actually calls the function on every re-render anyways, so it's really creating more work.
I created a small JSFiddle to demonstrate this in action - as the component re-renders, the function is also re-created.
If we would like to avoid functions re-creating on each re-render we can use React useCallback, but only where it is really necessary. The following article goes more into detail about when it may be necessary to use useCallback or useMemo.
If we agree on removing this from the style guide I can submit a PR.
After reading through the style guide I discovered something small in the following section.
The suggested format above actually calls the function on every re-render anyways, so it's really creating more work.
I created a small JSFiddle to demonstrate this in action - as the component re-renders, the function is also re-created.
If we would like to avoid functions re-creating on each re-render we can use React useCallback, but only where it is really necessary. The following article goes more into detail about when it may be necessary to use useCallback or useMemo.
If we agree on removing this from the style guide I can submit a PR.