'How to create a from dynamically from Json Schema without a library?
I have a JSONschema file that has almost everything in it, nested fields, references and definitions, object, string and various number types.
I am trying to create a CRUD app for creating a form based on the JSONschema which can be used for working with different JSONschema files.
So far I am following a rather procedural method, I created a function that checks the type field in an object and adds the matching type of JSX input element into an array. If there is nesting, it checks recursively and keeps adding the required JSX element. I am iterating that over the JSONschema object.
Then I return that array from a React component. It kinda works but I am not happy with how complex it is and how duct-tapey it works. Also, I should be able to load an already existing data as default values into the form but since the form is created element by element, loading data to fields is also proving to be difficult.
What is a more robust approach I can use here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
