This should be simple but I'm not finding the simple answer I want. I have a reducer:
const posts = (state = null, action) => {
switch(action.type){
case "PUBLISH_POST":
return state;
case "UNPUBLISH_POST":
return state;
default:
return postList;
}
}
I have a list of posts with ID's and a status. I'm sending in my post ID but can't figure out the logic to simply update the status from 0 to 1 for the item which has been clicked. I've found plenty of half-solutions but they all seem verbose and ugly - what's the shortest/best way of achieving it in this case?
Example data:
{
id:1,
user:"Bob Smith",
content:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vulputate mauris vitae diam euismod convallis. Donec dui est, suscipit at dui vitae, sagittis efficitur turpis. ",
status:1
}