Try to avoid directly setting state from event handlers and instead provide utility functions that mutate state in a consistent way.