Skip to content

v6: replacing useControlField Typescript problem #389

Answered by airjp73
ttiurani asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! The best way to create abstractions in v6 is to use the scoping API. You could write your example like this:

// You only need to depend directly on `@rvf/remix`
import { useField, FormScope } from "@rvf/remix";

// No "extends" because we can scope to anything
type RvfDebugProps<FormInputData> = {
  scope: FormScope<FormInputData>;
};

export const RvfDebug = <FormInputData>({
  scope,
}: RvfDebugProps<FormInputData>) => {
  const field = useField(scope);

  return (
    <div>
      <MyComponent
        onContentUpdate={(_, updatedContent) => {
          const cleanedContent = myClean(updatedContent);
          if (cleanedContent !== value) {
            // can use methods directly of…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ttiurani
Comment options

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