Get latest post

Hi,

How can I show the lastest post on my home page, dynamically? Because if I want to use actions.source.fetch() you need to know the URL, and I don’t know the URL, because the latest post changes every time I post something new.

Hi @kasper to show the latest post you can directly get it from the state like this

const data = state.source.get(state.router.link);


return(
    data.items.map(({ type, id }) => {

         const item = state.source[type][id];
         const author = state.source.author[item.author];        

       //Now you can use the item and author to show the post information
               
    })

)