Our app is currently loading all the messages only on the page's first load or when the user submits a new post.
Let's make the app refresh the post list.
7.1 – A little refactoring
Refactoring is the process of restructuring existing code without changing its external behavior.
The refactoring that we are going to perform consists in moving some code inside a function, in order to make it reusable in different parts of our app.
We need to reuse the code that retrieves and draws the messages in the page: