Attachable
Interface for something (e.g. a Component or a useEffect registration) which should receive callbacks when it is attached/detached from the tree.
Functions
Will be invoked when this Attachable is no longer part of the ComponentTree. This can be because the ComponentTree is released (and all Attachables are detached), or because this Attachable no longer appears in the ComponentTree in the most recent committed layout.
Given an Attachable (nextAttachable) with the same unique id as this Attachable and which is in the next layout, return whether it should be attached instead of the current Attachable. If true is returned, this Attachable will be detached and nextAttachable will be attached. If false is returned, this Attachable will remain attached and nextAttachable will be thrown away.
Legacy update behavior is that if shouldUpdate(Attachable) returns false, we should still replace the Attachable with the latest version of the Attachable. Practically speaking, this is needed for Layout Specs and the OnAttached/OnDetached API where OnAttached can be called with the initial component props, but OnDetached is expected to be called with the latest Component props.