Skip to content
Discussion options

You must be logged in to vote

You're mixing both controlled and uncontrolled input APIs: Controller and register respectively. The ref warning you see is due to the fact that you are spreading the return values of the register function into the Controller component, which is an RHF controlled input component and doesn't need to be registered.

 <Controller
   control={control}
+  name="zipcode"
+  rules={{
+     required: "À renseigner",
+     min: 5,
+     maxLength: 5
+  }}
-  render={({ field: { onChange, value, ref } }) => (
+  render={({ field: { name, onChange, onBlur, value, ref } }) => (
     <PatternFormat
       getInputRef={ref}
+      value={value}
+      onBlur={onBlur}
+      name={name}
+      onValueCha…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mrprst
Comment options

@Moshyfawn
Comment options

Answer selected by mrprst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants