Skip to content

Change all uses of RHF <Controller> to useController - #2102

Merged
david-crespo merged 1 commit into
mainfrom
use-controller
Mar 27, 2024
Merged

david-crespo merged 1 commit into
mainfrom
use-controller

Conversation

@david-crespo

Copy link
Copy Markdown
Collaborator

TIL <Controller> is just useController in a trenchcoat. Remove the trenchcoat. Render props are so 2016.

const Controller = <
  TFieldValues extends FieldValues = FieldValues,
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>(
  props: ControllerProps<TFieldValues, TName>,
) => props.render(useController<TFieldValues, TName>(props));

https://github.com/react-hook-form/react-hook-form/blob/306627e385738e322cad8dff9e752678f8210020/src/controller.tsx#L46-L51

@vercel

vercel Bot commented Mar 27, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Mar 27, 2024 7:07pm

@charliepark charliepark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@david-crespo
david-crespo merged commit e2a7bcd into main Mar 27, 2024
@david-crespo
david-crespo deleted the use-controller branch March 27, 2024 20:07
david-crespo added a commit that referenced this pull request Mar 29, 2024

This branch was successfully deployed

1 active deployment
Preview — ecfbd0da Deployed Mar 27, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants