Registers a TreeState that the StateProvider should use to supply the appropriate State value.
This function should typically be used together with exitScope in a try...finally block.
TreeState that should be used to supply State value