import React from 'react'
export const Pending = ({ items, setItems, updateStatus }) => {
return (
<div className="pending">
<h1>Pending</h1>
{
items && items.map(item => {
if (item && item.status === 'Pending')
return <>
<p className="item" key={item.id}>
{item.title}
<button className="mark_complete" key={item.id} onClick={() => { updateStatus(item.id, 'Completed') }}>Mark Complete</button>
</p>
</>
})
}
</div>
)
}
if condition is working in react version 18 but not working in version 17. Can anybody help how to change this code to version 17
CodePudding user response:
That's how you perform conditional rendering in JSX.