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C,EAAAA,IACd,sBAAIjC,UAAWC,EAAAA,GAAuCiC,GAAG,QAAzD,kBAGA,qBAAGlC,UAAWC,EAAAA,IAAd,mCAIA,uBAAKD,UAAWiC,EAAAA,IACd,gBAACpB,EAAA,EAAD,MAEA,4BACE,gBAAChB,EAAA,EAAD,CAAaC,gBAAiBA,EAAiBC,IAAKA,EAAAA,IAEpD,gBAACoC,EAAA,EAAD,CAAQrC,gBAAiBA,GAAmB,UCvBtD,eAAe,GAAsC,IAAnCsC,EAAkC,EAAlCA,SAChB,OACE,gBAAC,IAAD,CAAQA,SAAUA,EAAUC,YAAY,MACtC,gBAAC,IAAD,CAAKC,MAAM,iBAAiBF,SAAUA,IACtC,gBAAC,EAAD,CAAgBtC,gBAAgB,U,uPCR/B,IAAIyC,EAAO,+BACPC,EAAQ,gCACRC,EAAY,oCACZC,EAAO,+BACPC,EAAY,oCACZC,EAAY,oCACZC,EAAO,+BACPC,EAAW,mCACXlB,EAAW","sources":["webpack://react-hook-form-website/./src/components/FormContext.tsx","webpack://react-hook-form-website/./src/components/codeExamples/formContext.ts","webpack://react-hook-form-website/./src/components/Menu.tsx","webpack://react-hook-form-website/./src/components/UseFormContext.tsx","webpack://react-hook-form-website/./src/pages/api/useformcontext.en.tsx","webpack://react-hook-form-website/./src/components/SideMenu.module.css"],"sourcesContent":["import * as React from \"react\"\nimport CodeArea from \"./CodeArea\"\nimport formContext from \"./codeExamples/formContext\"\nimport generic from \"../data/generic\"\nimport * as typographyStyles from \"../styles/typography.module.css\"\nimport * as tableStyles from \"../styles/table.module.css\"\n\nexport default function FormContext({ currentLanguage, api }) {\n return (\n <>\n \n

\n useFormContext:{\" \"}\n Function\n

\n
\n\n {api.useFormContext.introduction}\n\n

Props

\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
{generic.name[currentLanguage]}{generic.type[currentLanguage]}{generic.description[currentLanguage]}
\n ...props\n \n Object\n \n Accept all useForm methods.\n
\n
\n\n {api.useFormContext.description}\n\n \n \n )\n}\n","export default `import React from \"react\";\nimport { useForm, FormProvider, useFormContext } from \"react-hook-form\";\n\nexport default function App() {\n const methods = useForm();\n const onSubmit = data => console.log(data);\n\n return (\n // pass all methods into the context\n
\n \n \n \n
\n );\n}\n\nfunction NestedInput() {\n const { register } = useFormContext(); // retrieve all hook methods\n return ;\n}\n`\n","import * as React from \"react\"\nimport { useStateMachine } from \"little-state-machine\"\nimport { Link } from \"gatsby\"\nimport { useLocation } from \"@reach/router\"\nimport colors from \"../styles/colors\"\nimport * as styles from \"./SideMenu.module.css\"\nimport * as typographyStyles from \"../styles/typography.module.css\"\nimport { updateCurrentLanguage } from \"../actions/languageActions\"\n\nconst pages = [\n {\n pathname: \"/api/useform\",\n name: \"useForm\",\n pages: [\n { pathname: \"/api/useform/register\", name: \"register\" },\n { pathname: \"/api/useform/unregister\", name: \"unregister\" },\n { pathname: \"/api/useform/formstate\", name: \"formState\" },\n { pathname: \"/api/useform/watch\", name: \"watch\" },\n { pathname: \"/api/useform/handlesubmit\", name: \"handleSubmit\" },\n { pathname: \"/api/useform/reset\", name: \"reset\" },\n { pathname: \"/api/useform/seterror\", name: \"setError\" },\n { pathname: \"/api/useform/clearerrors\", name: \"clearErrors\" },\n { pathname: \"/api/useform/setvalue\", name: \"setValue\" },\n { pathname: \"/api/useform/setFocus\", name: \"setFocus\" },\n { pathname: \"/api/useform/getvalues\", name: \"getValues\" },\n { pathname: \"/api/useform/trigger\", name: \"trigger\" },\n { pathname: \"/api/useform/control\", name: \"control\" },\n ],\n },\n {\n pathname: \"/api/usecontroller\",\n name: \"useController\",\n pages: [\n {\n pathname: \"/api/usecontroller/controller\",\n name: \"Controller\",\n },\n ],\n },\n {\n pathname: \"/api/useformcontext\",\n name: \"useFormContext\",\n },\n {\n pathname: \"/api/usewatch\",\n name: \"useWatch\",\n },\n {\n pathname: \"/api/useformstate\",\n name: \"useFormState\",\n pages: [\n {\n pathname: \"/api/useformstate/errormessage\",\n name: \"ErrorMessage\",\n },\n ],\n },\n {\n pathname: \"/api/usefieldarray\",\n name: \"useFieldArray\",\n },\n]\n\nfunction Menu() {\n const { state } = useStateMachine({ updateCurrentLanguage })\n const lightMode = state?.setting?.lightMode\n const { pathname } = useLocation()\n\n return (\n \n )\n}\n\nexport { Menu }\n","import * as React from \"react\"\nimport api from \"../data/en/api\"\nimport * as typographyStyles from \"../styles/typography.module.css\"\nimport FormContext from \"./FormContext\"\nimport Footer from \"./Footer\"\nimport { Menu } from \"./Menu\"\nimport * as containerStyles from \"../styles/container.module.css\"\n\nexport default function UseFieldArray({\n currentLanguage,\n}: {\n currentLanguage: string\n}) {\n return (\n
\n

\n useFormContext\n

\n

\n React Context API for hook form\n

\n\n
\n \n\n
\n \n\n
\n
\n
\n
\n )\n}\n","import * as React from \"react\"\nimport Seo from \"../../components/seo\"\nimport Layout from \"../../components/layout\"\nimport UseFormContext from \"../../components/UseFormContext\"\n\nexport default ({ location }: { location: any }) => {\n return (\n \n \n \n \n )\n}\n","// extracted by mini-css-extract-plugin\nexport var menu = \"SideMenu-module--menu--2pmVQ\";\nexport var arrow = \"SideMenu-module--arrow--kte6y\";\nexport var arrowLast = \"SideMenu-module--arrowLast--Ln3zG\";\nexport var size = \"SideMenu-module--size--3tZ4v\";\nexport var lightMenu = \"SideMenu-module--lightMenu--F0Lxu\";\nexport var titleList = \"SideMenu-module--titleList--ydVFH\";\nexport var code = \"SideMenu-module--code--lBWpe\";\nexport var menuItem = \"SideMenu-module--menuItem--eLHu4\";\nexport var isActive = \"SideMenu-module--isActive--2gopj\";"],"names":["FormContext","currentLanguage","api","className","typographyStyles","useFormContext","introduction","tableStyles","generic","description","CodeArea","rawData","url","pages","pathname","name","Menu","state","useStateMachine","updateCurrentLanguage","lightMode","setting","useLocation","styles","style","fontSize","color","colors","paddingBottom","map","page","isActive","key","Link","to","UseFieldArray","containerStyles","id","Footer","location","defaultLang","title","menu","arrow","arrowLast","size","lightMenu","titleList","code","menuItem"],"sourceRoot":""}