The special child screen part, which only updates when its "gifts" (properties) change, relies on comparing the current gifts to the previous gifts. When a function like `doSomething` is passed as a gift, the child typically checks if the function's *reference* has changed. In JavaScript, if a parent screen part rebuilds and defines a function directly within its render logic, even if the function's code is identical, a *new function object* is created in memory each time. This new function object has a different memory address, meaning its reference is different from the one passed in the previous render. Consequently, the child's comparison mechanism will see a changed gi....
Log in to view the answer