I have below array of objects as sample input. I have this object available on page load of component.
I need to iterate on it and then fetch its Label Name,its input type and text associated to it.
Say suppose for first objet, I need to show label and its input type is dropdown and its text in one row, then go to second object show its lable text, its input type is textbox and then text on second row and so on for all other objects.
It should happen on run time when page is loading. I am not sure how to do it.
I just need to render it on page load. So I know that I need to write that code in componentDidMount()
method but how to render is not sure.
While I am looking for sample code but approach to resolve it will also help me to solve it on my own. Thanks in advance.
[
{
"LABEL_NAME": "Purpose",
"LABEL_TYPE": "STANDARD_LABEL",
"WIDGET_TYPE": "NARROW_DROPDOWN",
"TEXT": "Abc"
},
{
"LABEL_NAME": "Sub-purpose",
"LABEL_TYPE": "STANDARD_LABEL",
"WIDGET_TYPE": "Textbox",
"HELP_TEXT": "pqr"
},
{
"LABEL_NAME": "Date",
"LABEL_TYPE": "STANDARD_LABEL",
"WIDGET_TYPE": "DATE_FIELD",
"HELP_TEXT": null
}
]