Note that when the peer is updated, the previous peer (if it exists) will be disposed.
Like react, but also invokes the function with the current state immediately.
react