Allow the state update to depend on input elements