Binding to state changes and updating internal state