Created
April 12, 2023 00:06
-
-
Save solanoize/95aa3250674b991f04522c0e29a352db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const computedTotal = useMemo(() => { | |
| let sum = 0; | |
| if (itemSales.length > 0) { | |
| for (let item of itemSales) { | |
| sum += item.price * item.qty; | |
| } | |
| } | |
| setSale((values) => ({ ...values, total: sum })); | |
| return null; | |
| }, [itemSales]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment