factor-out ajax state tracking into the <ajax-state/> component