Testing

$330

The key is that the onSubmit function, defined inside the onSelect function, creates a closure. This means it retains access to variables declared within the onSelect scope, including hasError