{"id":16660080,"url":"https://github.com/dvingo/malli-react-hook-form","last_synced_at":"2025-07-31T09:12:38.176Z","repository":{"id":140862212,"uuid":"588698697","full_name":"dvingo/malli-react-hook-form","owner":"dvingo","description":"Sample app demonstrating how to integrate malli with react-hook-form","archived":false,"fork":false,"pushed_at":"2023-01-14T15:03:46.000Z","size":250,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"mainline","last_synced_at":"2025-04-09T18:55:59.781Z","etag":null,"topics":["clojurescript","malli","react-hook-form"],"latest_commit_sha":null,"homepage":"https://dvingo.github.io/malli-react-hook-form/","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvingo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-13T19:11:33.000Z","updated_at":"2024-07-02T09:21:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"78697964-60f0-4c9f-a351-85a8f410de20","html_url":"https://github.com/dvingo/malli-react-hook-form","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dvingo/malli-react-hook-form","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvingo%2Fmalli-react-hook-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvingo%2Fmalli-react-hook-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvingo%2Fmalli-react-hook-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvingo%2Fmalli-react-hook-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvingo","download_url":"https://codeload.github.com/dvingo/malli-react-hook-form/tar.gz/refs/heads/mainline","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvingo%2Fmalli-react-hook-form/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268017061,"owners_count":24181660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojurescript","malli","react-hook-form"],"created_at":"2024-10-12T10:27:50.315Z","updated_at":"2025-07-31T09:12:38.131Z","avatar_url":"https://github.com/dvingo.png","language":"Clojure","readme":"This repo demonstrates how to use [malli](https://github.com/metosin/malli) schemas to validate forms with [react-hook-form](https://react-hook-form.com/get-started)\n\nYou can see the running example on github pages:\n\n[dvingo.github.io/malli-react-hook-form](https://dvingo.github.io/malli-react-hook-form/)\n\n\nTo integrate in your own codebase the main point of integration is a malli validation helper\nto output errors in the shape used by react-hook-form:\n\n```clojure\n(defn use-malli-resolver [schema]\n  (let [validator (m/validator schema)\n        explain   (m/explainer schema)]\n    (hooks/use-callback [schema]\n      (fn [data-js]\n        (let [data   (js-\u003eclj data-js :keywordize-keys true)\n              valid? (validator data)]\n          (if valid?\n            #js{:values data :errors #js{}}\n            (let [errs (reduce-kv\n                         (fn [errs field messages]\n                           (doto errs\n                             (g/set (name field) #js{:type \"validation\" :message (first messages)})))\n                         #js{}\n                         (me/humanize (explain data)))]\n              #js{:values #js{} :errors errs})))))))\n\n;; then in your render function use this \"resolver\":\n\n(let [resolver      (use-malli-resolver form-schema)\n      form-methods  (useForm #js{:resolver resolver})\n```\n\n# Running locally\n\nprerequisites:\n\nnode+npm\njava \nclojure \nyarn 1.x\n\nAfter cloning the repo:\n\n```bash\nyarn install\nyarn shadow-cljs watch main\n```\n\nnavigate to http://localhost:4023\n\n# Credits\n\nThe idea of making reusable form input components on top of controlled UI libraries comes from:\n\nhttps://koprowski.it/react-native-form-validation-with-react-hook-form-usecontroller/\n\nand figuring out how to use custom validation is from the react-hook-form docs\n\nhttps://react-hook-form.com/advanced-usage#CustomHookwithResolver\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvingo%2Fmalli-react-hook-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvingo%2Fmalli-react-hook-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvingo%2Fmalli-react-hook-form/lists"}