reactjs/react-tutorial

Data output with order by created_at

crusadergo opened this issue · 1 comments

Hi, guys! I have a question.
I have the dynamically list of posts. When i click "Post" button, new post created at the bottom of the list, but i want to see new post at the top of list. How can I do this?

zpao commented

Our example servers always insert at the end. You could change the servers (eg you could unshift instead of push https://github.com/reactjs/react-tutorial/blob/master/server.js#L45). Or you could reverse the sort on the client. We'll have an id for each comment in the future which will just be a timestamp you could use to sort.