From 5588ec10b2d15a552811998cf09b285421af075b Mon Sep 17 00:00:00 2001 From: margaretkennedy <82049573+margaretkennedy@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:01:34 -0400 Subject: [PATCH] Update use_memo.md Adding one comma and removing one extra space. --- plugins/ui/docs/hooks/use_memo.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ui/docs/hooks/use_memo.md b/plugins/ui/docs/hooks/use_memo.md index 6ac767e66..a1ae8999f 100644 --- a/plugins/ui/docs/hooks/use_memo.md +++ b/plugins/ui/docs/hooks/use_memo.md @@ -31,8 +31,8 @@ Recommendations for memoizing values: 1. **Use memoization for expensive computations**: If you have a value that is expensive to compute, use `use_memo` to memoize the value between renders. 2. **Use dependencies**: Pass in only the dependencies that the memoized value relies on. If any of the dependencies change, the memoized value is re-computed. If another prop or state value changes, the computation is not re-run. -3. **Do not use for cheap computations**: There is small overhead to memoizing values, so only use `use_memo` for expensive computations. If the value is cheap to compute, it is not worth memoizing. -4. **Memoize table/plot operations**: If you are working with a table, memoize the table or plot operation storing the result in a memoized value. This will prevent the table or plot from being re-computed on every render. +3. **Do not use for cheap computations**: There is a small overhead to memoizing values, so only use `use_memo` for expensive computations. If the value is cheap to compute, it is not worth memoizing. +4. **Memoize table/plot operations**: If you are working with a table, memoize the table or plot operation, storing the result in a memoized value. This will prevent the table or plot from being re-computed on every render. ## Optimizing performance @@ -210,7 +210,7 @@ memo_table_app = ui_memo_table_app() ## Memoize each item in a list -`use_memo` is a hook, and like any other hook, can only be called at the top level of a component. Suppose you are listing several items, and you want them to be memoized individually. However, you can't use `use_memo` , as an error is thrown if the count of hooks changes between renders: +`use_memo` is a hook, and like any other hook, can only be called at the top level of a component. Suppose you are listing several items, and you want them to be memoized individually. However, you can't use `use_memo`, as an error is thrown if the count of hooks changes between renders: ```python from deephaven import ui