{"id":66171,"date":"2019-05-30T04:15:14","date_gmt":"2019-05-30T11:15:14","guid":{"rendered":"http:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/"},"modified":"2019-05-30T04:15:14","modified_gmt":"2019-05-30T11:15:14","slug":"creating-your-own-react-validation-library-the-developer-experience-part-3","status":"publish","type":"post","link":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/","title":{"rendered":"Creating Your Own React Validation Library: The Developer Experience (Part 3)"},"content":{"rendered":"<link rel=\"canonical\" href=\"https:\/\/www.smashingmagazine.com\/2019\/05\/react-validation-library-developer-experience-part3\/\"><title>Creating Your Own React Validation Library: The Developer Experience (Part 3)<\/title><\/p>\n<article>\n<header>\n<h1>Creating Your Own React Validation Library: The Developer Experience (Part 3)<\/h1>\n<address>Kristofer Selbekk<\/address>\n<p>                  <time datetime=\"2019-05-30T13:00:59+02:00\">2019-05-30T13:00:59+02:00<\/time><time datetime=\"2019-05-30T11:05:38+00:00\">2019-05-30T11:05:38+00:00<\/time><\/header>\n<p>If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it, and it even helps out with accessibility concerns! Its only downfall is that it sucks to work with.<\/p>\n<p>Yep, that\u2019s right. The user experience from a developer point of view is seriously lacking. We don\u2019t get any helpful warnings when we misspell words, misuse APIs or, well, anything, really!<\/p>\n<p>This article will guide you through how you can improve the developer experience of your validation library \u2014 or any library for that sake.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.smashingmagazine.com\/2019\/05\/react-validation-library-basics-part1\/\">Part 1: The Basics<\/a><\/li>\n<li><a href=\"https:\/\/www.smashingmagazine.com\/2019\/05\/react-validation-library-features-part2\/\">Part 2: The Features<\/a><\/li>\n<li><strong>Part 3: The Experience<\/strong><\/li>\n<\/ul>\n<h3>Starting Out<\/h3>\n<p>Since the last part of this article, we\u2019ve pulled out all library code into its own files. Take a look at the <a href=\"https:\/\/codesandbox.io\/embed\/1v12lj234j?fontsize=14\">CodeSandbox demo<\/a> to see what we\u2019re starting out with.<\/p>\n<div data-component=\"FeaturePanel\" data-audience=\"non-subscriber\" data-remove=\"true\"><\/div>\n<h3>Convenience Functions<\/h3>\n<p>We want our library to be as simple as possible to use for the most common cases. A way to move towards that goal is to add convenient utility functions for certain functionality.<\/p>\n<p>One such feature could be to check if our form is valid \u2014 that is, if all error messages are <code>null<\/code>. This is something you typically check in your <code>onSubmit<\/code> handler, but it could be useful in your render-method too. Let\u2019s implement it!<\/p>\n<pre><code>const isFormValid = useMemo(\n  () => Object.values(errors).every(error => error === null), \n  [errors]\n);\n<\/code><\/pre>\n<p>We\u2019ll provide this flag in our <code>onSubmit<\/code> form handler, as well as in our render method.<\/p>\n<ul>\n<li><a href=\"https:\/\/codesandbox.io\/embed\/qq19vyp0q6?fontsize=14\">See CodeSandbox demo<\/a><\/li>\n<\/ul>\n<p>There are plenty more of these that could be written, but I\u2019ll let that be an exercise for the reader.<\/p>\n<h3>Development Warnings And Invariants<\/h3>\n<p>One of React\u2019s greatest features is its many helpful console warnings while developing. We should provide the same sort of quality to our users as well.<\/p>\n<p>To get started, we\u2019ll create two functions \u2014 <code>warning<\/code> for logging warnings to the console, and <code>invariant<\/code> for throwing an error \u2014 both if a given condition is not met.<\/p>\n<pre><code>function warning(condition, message) {\n  if (process.env.NODE_ENV === 'production' || condition) {\n    return;\n  }\n\n  console.warn('useValidation: ' + message);\n}\nfunction invariant(condition, message) {\n  if (process.env.NODE_ENV === 'production' || condition) {\n    return;\n  }\n\n  throw new Error('useValidation: ' + message);\n}\n<\/code><\/pre>\n<p>You want to use <code>invariant<\/code> if the error is going to crash your library (or render it useless), and <code>warning<\/code> for bad practices or other advice.<\/p>\n<h4>When To Warn<\/h4>\n<p>Deciding when to warn is pretty important. Too many, and you\u2019re just annoying. Too few, and you let critical bugs ship to production. Therefore, we need to be smart with our warnings.<\/p>\n<p>Since our library accepts a pretty large configuration object, it makes sense to validate this somehow \u2014 at least while developing. We could solve it by using a type system like TypeScript or Flow, but that excludes all regular ol\u2019 JavaScript users.<\/p>\n<p>Instead, let\u2019s create a runtime schema checker, where we validate that the config contains the correct fields, and print relevant warnings.<\/p>\n<div>\n<pre><code>function validateConfigSchema(config) {\n  if (process.env.NODE_ENV === 'production') {\n    return;\n  }\n  if (typeof config === 'function') {\n    config = config({});\n  }\n\n  invariant(\n    typeof config === 'object',\n    `useValidation should be called with an object or a function returning an object. You passed a ${typeof config}.`,\n  );\n\n  invariant(\n    typeof config.fields === 'object',\n    'useValidation requires a `field` prop with an object containing the fields and their validators. Please refer to the documentation on usage: https:\/\/link.to\/docs'\n  );\n\n  \n  invariant(\n    Object.values(config.fields).every(field => typeof field === 'object'),\n    'useValidation requires that the `field` object only contains objects. It looks like yours isn't. Please refer to the documentation on usage: https:\/\/link.to\/docs'\n  );\n\n  warning(\n    ['always', 'blur', 'submit', undefined].includes(config.showError),\n    'useValidation received an unsupported value in the `showError` prop. Valid values are \"always\", \"blur\" or \"submit\".'\n  )\n\n  \/\/ And so on\n}\n<\/code><\/pre>\n<\/div>\n<p>We could probably go on doing this for a while if we wanted to spend the time. And you should! It\u2019s a great way to improve the developer experience of your app.<\/p>\n<p>You don\u2019t have to be writing these by hand, however. There\u2019s a browser-port of the popular object schema validation library <a href=\"https:\/\/github.com\/jeffbski\/joi-browser\"><code>joi<\/code><\/a> that could help out with creating a really nice runtime validation check. Also, as previously mentioned, a type system would help catch configuration errors at compile time for the users that use that type system.<\/p>\n<div><\/div>\n<h3>Allow For Flexibility<\/h3>\n<p>A good developer experience is in large part not getting in the way of the developers. Let\u2019s look at a few ways we can improve that experience.<\/p>\n<h4>Compose Conflicting Props<\/h4>\n<p>First, our prop getters apply some props to our inputs and forms that can be accidentally overridden by our consumers. Instead, let\u2019s add a prop override object to our prop getters, which will compose any conflicting props together.<\/p>\n<p>Here\u2019s how we can implement this in our <code>getFieldProps<\/code>:<\/p>\n<pre><code>\ngetFieldProps: (fieldName, overrides = {}) => ({\n  onChange: e => {\n    const { value } = e.target;\n    if (!config.fields[fieldName]) {\n      return;\n    }\n    dispatch({\n      type: 'change',\n      payload: { [fieldName]: value },\n    });\n    if (overrides.onChange) {\n      overrides.onChange(e);\n    }\n  },\n  onBlur: e => {\n    dispatch({ type: 'blur', payload: fieldName });\n    if (overrides.onBlur) {\n      overrides.onBlur(e)\n    }\n  },\n  name: overrides.name || fieldName,\n  value: state.values[fieldName] || '',\n}),\n<\/code><\/pre>\n<p>A similar approach can be followed in <code>getFormProps<\/code>.<\/p>\n<h4>Help Avoid Prop Drilling<\/h4>\n<p>Some forms might be large and split up into several components. Instead of making our consumers\u2019 drill props down the tree, we should provide a context. This way, they can access all the stuff we return from our custom hook anywhere in the tree below.<\/p>\n<p>First, let\u2019s create a ValidationContext with React\u2019s <code>createContext<\/code> method:<\/p>\n<pre><code>export const ValidationContext = React.createContext({});\n<\/code><\/pre>\n<p>Next, let\u2019s create a component <code>ValidationProvider<\/code>, that provides all the values from the <code>useValidation<\/code> hook in context instead:<\/p>\n<pre><code>export const ValidationProvider = props => {\n  const context = useValidation(props.config);\n  return (\n    <validationcontext.provider value=\"{context}\">\n      {props.children}\n    <\/validationcontext.provider>\n  );\n};\n<\/code><\/pre>\n<p>Now, instead of calling <code>useValidation<\/code> directly, we\u2019d wrap our form in a <code>ValidationProvider<\/code> component, and get access to the validation props (<code>getFormProps<\/code>, <code>errors<\/code> etc) by use of the <a href=\"https:\/\/reactjs.org\/docs\/hooks-reference.html#usecontext\"><code>useContext<\/code> hook<\/a>. You\u2019d use it like this:<\/p>\n<pre><code>Import React, { useContext } from 'react';\nimport { ValidationContext } from '.\/useValidation';\n\nfunction UsernameForm(props) {\n  const { getFieldProps, errors } = useContext(ValidationContext);\n  return (\n    <>\n      <input {...getFieldProps('username')} \/>\n      {errors.username && <span classname=\"error\">{errors.username}><\/span>}\n    <\/>\n  );\n}\n<\/span><\/code><\/pre>\n<p>This way, you get the best of both worlds! You get a simple hook for those simple scenarios, and you get the flexibility you need for those complex parts.<\/p>\n<div><\/div>\n<h3>Documentation Is Key ?<\/h3>\n<p>Whenever I\u2019m using a library I didn\u2019t write myself, I love great documentation. But what should you focus on, and where should you document?<\/p>\n<p>A first step should be to put together a simple to understand README, with the most basic usage examples readily available. <a href=\"https:\/\/dev.to\/healeycodes\">Andrew Healey<\/a> wrote an amazing piece on <a href=\"https:\/\/dev.to\/healeycodes\/how-to-write-an-awesome-github-readme-2ldc\">how to write a good README<\/a>, which I highly recommend you read.<\/p>\n<p>When you\u2019ve created a good README to get people going, a documentation website might be a good idea. Here, you can put a more in-depth API documentation, recipes for typical use cases and a good ol\u2019 FAQ.<\/p>\n<p>There are great tools out there for generating documentation websites. My favorite is <a href=\"https:\/\/docusaurus.io\/\"><code>docusaurus<\/code> from Facebook<\/a> (humble brag: we used it when creating the <code>create-react-app<\/code> website), but there are several good alternatives out there.<\/p>\n<p>We\u2019re not going to go through how to write good documentation in this article. There are several good articles out there \u2014 even a community called \u201c<a href=\"https:\/\/www.writethedocs.org\/\">Write the Docs<\/a>\u201d. They have written a great guide to <a href=\"https:\/\/www.writethedocs.org\/guide\/writing\/beginners-guide-to-docs\/\">how you can get started with writing great documentation<\/a>.<\/p>\n<h3>Summary<\/h3>\n<p>Through this article series, we\u2019ve created a pretty decent validation library. It has a pretty simple API, flexibility for when you need it, a good developer experience, and a lot of pretty dank features.<\/p>\n<p>We\u2019ve gone through how we implemented things step by step, and I hope you got a deeper understanding of how you can make your own library, and how you make it something people would love to use.<\/p>\n<p>Please let me know in the comments what you think, and if there were some parts you got stuck on or had a hard time understanding. I\u2019ll try my best to update the article as feedback trickles in.<\/p>\n<p>To end this article off \u2014 here\u2019s the final version:<\/p>\n<ul>\n<li><a href=\"https:\/\/codesandbox.io\/embed\/749z4p21j?fontsize=14\">See CodeSandbox demo<\/a><\/li>\n<\/ul>\n<p>Thanks for reading!<\/p>\n<div>\n  <img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/05\/logo-red-22.png?w=900\" alt=\"Smashing Editorial\"><span>(dm, yk, il)<\/span>\n<\/div>\n<\/article>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating Your Own React Validation Library: The Developer Experience (Part 3) Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00 If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw&#8230;<a class=\"moretag\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/\"> Read the full article&#8230;<\/a><\/p>\n","protected":false},"author":4,"featured_media":66172,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[371],"tags":[],"class_list":["post-66171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-user-experience"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Guest Contribution\"\/>\n\t<meta name=\"keywords\" content=\"user experience\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies\" \/>\n\t\t<meta property=\"og:description\" content=\"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-05-30T11:15:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-05-30T11:15:14+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#article\",\"name\":\"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies\",\"headline\":\"Creating Your Own React Validation Library: The Developer Experience (Part 3)\",\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/logo-red-22.png?fit=60%2C80&ssl=1\",\"width\":60,\"height\":80},\"datePublished\":\"2019-05-30T04:15:14-07:00\",\"dateModified\":\"2019-05-30T04:15:14-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#webpage\"},\"articleSection\":\"User Experience\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"position\":2,\"name\":\"User Experience\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#listItem\",\"name\":\"Creating Your Own React Validation Library: The Developer Experience (Part 3)\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#listItem\",\"position\":3,\"name\":\"Creating Your Own React Validation Library: The Developer Experience (Part 3)\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/\",\"name\":\"Guest Contribution\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Guest Contribution\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#webpage\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/\",\"name\":\"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies\",\"description\":\"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\\u2019ve been following along this little article series, you\\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/logo-red-22.png?fit=60%2C80&ssl=1\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#mainImage\",\"width\":60,\"height\":80},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/05\\\/creating-your-own-react-validation-library-the-developer-experience-part-3\\\/#mainImage\"},\"datePublished\":\"2019-05-30T04:15:14-07:00\",\"dateModified\":\"2019-05-30T04:15:14-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies","description":"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,","canonical_url":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/","robots":"max-image-preview:large","keywords":"user experience","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#article","name":"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies","headline":"Creating Your Own React Validation Library: The Developer Experience (Part 3)","author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/05\/logo-red-22.png?fit=60%2C80&ssl=1","width":60,"height":80},"datePublished":"2019-05-30T04:15:14-07:00","dateModified":"2019-05-30T04:15:14-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#webpage"},"isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#webpage"},"articleSection":"User Experience"},{"@type":"BreadcrumbList","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.taterboy.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","position":2,"name":"User Experience","item":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#listItem","name":"Creating Your Own React Validation Library: The Developer Experience (Part 3)"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#listItem","position":3,"name":"Creating Your Own React Validation Library: The Developer Experience (Part 3)","previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}}]},{"@type":"Organization","@id":"https:\/\/www.taterboy.com\/blog\/#organization","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","url":"https:\/\/www.taterboy.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author","url":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/","name":"Guest Contribution","image":{"@type":"ImageObject","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g","width":96,"height":96,"caption":"Guest Contribution"}},{"@type":"WebPage","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#webpage","url":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/","name":"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies","description":"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#breadcrumblist"},"author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"creator":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/05\/logo-red-22.png?fit=60%2C80&ssl=1","@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#mainImage","width":60,"height":80},"primaryImageOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/#mainImage"},"datePublished":"2019-05-30T04:15:14-07:00","dateModified":"2019-05-30T04:15:14-07:00"},{"@type":"WebSite","@id":"https:\/\/www.taterboy.com\/blog\/#website","url":"https:\/\/www.taterboy.com\/blog\/","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","og:type":"article","og:title":"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies","og:description":"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,","og:url":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/","article:published_time":"2019-05-30T11:15:14+00:00","article:modified_time":"2019-05-30T11:15:14+00:00","twitter:card":"summary","twitter:title":"Creating Your Own React Validation Library: The Developer Experience (Part 3) | Design for Immersive Technologies","twitter:description":"Creating Your Own React Validation Library: The Developer Experience (Part 3)Creating Your Own React Validation Library: The Developer Experience (Part 3) Kristofer Selbekk 2019-05-30T13:00:59+02:002019-05-30T11:05:38+00:00If you\u2019ve been following along this little article series, you\u2019ve now learned how to put together your very own validation library. It can handle almost any challenge you can throw at it,"},"aioseo_meta_data":{"post_id":"66171","title":null,"description":null,"keywords":null,"keyphrases":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_custom_image_width":null,"og_custom_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"created":"2021-02-07 19:44:58","updated":"2026-09-01 11:29:38","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"twitter_image_url":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/\" title=\"User Experience\">User Experience<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tCreating Your Own React Validation Library: The Developer Experience (Part 3)\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.taterboy.com\/blog"},{"label":"User Experience","link":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/"},{"label":"Creating Your Own React Validation Library: The Developer Experience (Part 3)","link":"https:\/\/www.taterboy.com\/blog\/2019\/05\/creating-your-own-react-validation-library-the-developer-experience-part-3\/"}],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8wzr5-hdh","jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/05\/logo-red-22.png?fit=60%2C80&ssl=1","_links":{"self":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/66171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/comments?post=66171"}],"version-history":[{"count":0,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/66171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media\/66172"}],"wp:attachment":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media?parent=66171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/categories?post=66171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/tags?post=66171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}