As @hbar1st points out you must wrap the curly brackets with parentheses ( ), because when you use arrow function syntax => { }, JavaScript interprets the { } as a code block instead of something to return. Surrounding the { } lets JavaScript know you want to return what is inside the ( ).
Otherwise, you would have needed to add a return statement like below, which makes the arrow function less concise than it could be.
var mapStateToProps = (state) => { return {messages: state} };