I'm trying to render button component based on the API response.
Button response structure
"buttons": {
"yesButton": {
"buttonText": "Yes",
},
"noButton": {
"buttonText": "No"
}
}
componentContent.buttons is returning two objects with button contents and the data is getting printed in the console.
But in the view I'm not seeing any buttons html.
What I'm doing wrong here?
const renderComponentButtons = () => {
if (componentContent?.buttons) {
console.log(componentContent?.buttons);
Object.keys(componentContent.buttons).forEach((key) => {
console.log(key);
return (
<ButtonAction
aria-label={componentContent.buttons[key].buttonText}
onClick={() => {
props.toPrev();
}}
>
{componentContent.buttons[key].buttonText}
</ButtonAction>
);
});
}
};
return (
<div className="row">
<div className="col-md-4">
{renderComponentButtons()}
</div>
</div>
)
