Using list widget for ‘code blocks’ for ‘advanced’ page layouts.
In the ‘advanced’ Custom Preview template I want to return html based on ‘code block type’
How to do conditional code inside custom Template?
I am trying the following code but nothing is returned to the template.
import React from “react”;
export default class advancedPreview extends React.Component {
render() {
const {entry, widgetFor, getAsset} = this.props;
entry.getIn(["data","sections"]).map((thissection) => {
if (thissection.get("type") === 'blog_feed_section') {
return <h2>Show Blog Section</h2>
}
if (thissection.get("type") === 'contact_section') {
return <h2>Show Contact Section </h2>
}
if (thissection.get("type") === 'content_section') {
return <h2>Content Section</h2>
}
}
)
}
}
====================================================================