10 Matching Annotations
- Oct 2020
-
github.com github.com
-
React hook for creating a value exactly once. useMemo doesn't give this guarantee unfortunately - https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
-
- Sep 2020
-
svelte.dev svelte.dev
-
for example, reactive declarations essentially do the work of React's useMemo, useCallback and useEffect without the boilerplate (or indeed the garbage collection overhead of creating inline functions and arrays on each state change).
-
-
www.javascriptjanuary.com www.javascriptjanuary.com
-
You know those useMemo and useCallback hooks? Well, Svelte has something like this. If you declare a variable like this: $: double = counter * 2;, Svelte will recalculate it only if counter changes.
-
- Oct 2019
-
kentcdodds.com kentcdodds.com
-
useMemo is similar to useCallback except it allows you to apply memoization to any value type (not just functions). It does this by accepting a function which returns the value and then that function is only called when the value needs to be retrieved
-
-
-
github.com github.com
- Sep 2019
-
stackoverflow.com stackoverflow.com
-
If you want to use hooks, useMemo hook can be likely be used in parent component to calculate remountKey.
-
const remountKey = useMemo(() => Math.random(), listOfObjects);
-
- Aug 2019
-
-
This is a design choice to avoid the use of useMemo, which is not recommended for a semantic guarantee.
-