Update state sould get state as val and not ref.