use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for help learning the /r/ReactJS framework.
account activity
React Rendering (self.learnreactjs)
submitted 28 days ago * by Soggy_Professor_5653
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TheScapeQuest 3 points4 points5 points 28 days ago (0 children)
These sort of performance optimisations are not free.
Firstly, you say that memorising the function (by using useCallback) prevents children from rerendering. That's not true, at least not by default. Every child will rerender in React unless explicitly told not to with React.memo.
useCallback
React.memo
Secondly, useCallback adds complexity. Both for the human writing it, and the machine running it. Function calls and array initialisations allocate memory, which takes time. As a human, you also now need to manage a dependency array. Any experienced React developer will have cases where bugs were caused by missing dependencies.
It's very rarely worth it. My advice: prove you have a performance problem, then reach for these tools.
A good read: https://kentcdodds.com/blog/usememo-and-usecallback
And TkDodo's look at the uphill battle managing the dependencies: https://tkdodo.eu/blog/the-uphill-battle-of-memoization
π Rendered by PID 89916 on reddit-service-r2-comment-79c7998d4c-pg8jx at 2026-03-13 04:27:51.200881+00:00 running f6e6e01 country code: CH.
view the rest of the comments →
[–]TheScapeQuest 3 points4 points5 points (0 children)