Answer the question
In order to leave comments, you need to log in
How to optimize rerender in React?
Hello. Guys, tell me how to optimize so that the re-render would be only if the cDOptions prop has changed?
https://codepen.io/dc65k/pen/xxwbKOm
I tried these ways, but it didn't work:
const memoizedCallback = useCallback(
() => {
setCDOptions(setOptions())
},
[cDOptions]
)
return memoizedCallback
const memoizedValue = useMemo(() => setCDOptions(setOptions()), [cDOptions])
return memoizedValue
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question