I have a template like this:
const Template = ({ data }) => {
const { id } = data.Page
const postNode = data.Page
return (
<Layout>
// conditional logic here
// if {id} is 40 output <AdditionalContent />
</Layout>
)
}
I want to know if it is possible to check the id to see if it is 40, then output <AdditionalContent> component.
You can define like this
const Template = ({ data }) => {
const { id } = data.Page
const postNode = data.Page
return (
<Layout>
{id===40 && <AdditionalContent />}
</Layout>
)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With