additional effect if it is called more than once with the same input parameters. • Removing an item from a set is an idempotent operation on the set. • The abs() function is idempotent because abs(abs(x)) = abs(x) for all x .
with every render • Avoid Layout Thrash ◦ Reading from the DOM can force a reflow ◦ i.e. if we set a value and read from the DOM it might force the browser to recalculate the layout of a page, which is an expensive operation ◦ Ift doesn’t happen in React b/c of: • Queue Updates ◦ Batching DOM read/write operations ◦ Executed after reconciliation
view layer ◦ Conceptually re-render the whole app on every update ◦ Avoid O(N²-N) state transition complexity (avoid writing transitions) • Virtual DOM ◦ Lightweight descriptors that specify the desired render tree • Reconciliation ◦ Calculates a minimal set of changes to apply to the DOM