I don’t understand why useCallback
always returns a new ref each time one of the deps is updated. It results in many re-render that React.memo()
could have avoided.
What is, if any, the problem with this implementation of useCallback
?
export function useCallback(callback, deps) {
const callbackRef = useRef(callback);
useMemo(
() => callbackRef.current = callback,
deps
);
return useState(() =>
(...args) => callbackRef.current(...args)
)[0];
}
Using this instead of the built-in implementation sure has a significant positive impact on performance.
where can you buy cialis cheap – tadalafil tablets cialis pill generic
generic cialis price comparison – buy cialis pills online cheap cialis no prescription
where to buy ivermectin for humans – ivermectin 0.2mg stromectol 3 mg tablet price
legitimate online slots for money – online slots slots online
best ed pills – male erection pills free ed pills
buy cialis 20mg – Cialis prices buy cialis online canadian pharmacy
ivermectin cost in usa – ivermectine online ivermectin 50mg/ml
natural remedies for erectile dysfunction – ed pills comparison pills erectile dysfunction
ventolin generic brand – gnrventolin.com ventolin medication
where to buy otc viagra – 12.5 mg viagra daily viagra without prescription online
If this data is real, I am shocked.
buy acillin without prescription – purchase ciprofloxacin sale buy plaquenil online
purchase doxycycline online cheap – prednisolone over the counter levothyroxine uk