Skip to content
Discussion options

You must be logged in to vote

@sprobejames : This is not a bug. You are integrating react-hook-form with MUI in a wrong way.

  1. MUI component date picker is not a native input element therefore using {...register('fromDate')} does not work as MUI date picker is using "inputRef" prop to pass ref callback not normal "ref" prop name.
  2. When working with custom component like MUI, it's recommended to use "useController" hook or "Controller" component. The reason is because custom component like MUI is usually handling field value by themself and only interact with outside via callback like "onChange", "onBlur", "onError" therefore react-hook-form handling should be passed to <DatePicker> component, not to <TextField> componen…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@leapful
Comment options

leapful Oct 20, 2022
Collaborator

@sprobejames
Comment options

@belics-avrogan
Comment options

@leapful
Comment options

leapful Jul 6, 2023
Collaborator

@kam-st
Comment options

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

This discussion was converted from issue #9243 on October 19, 2022 08:22.