Hi,
I have a question around good syntax. I am picking up React and functional programming in general, and am pretty new to both. Have started including ESLint to help improve my code. Have a block below…
class UsersList extends Component {
getUsers() {
return this.props.users.map((user) => { \\ ESLINT highlights this...
return (
<User
key = {user._id}
user = {user}
/>
);
});
}
render() {
return (
<div className="container">
{this.getUsers()}
</div>
);
}
}
ESLINT highlights the above and says ‘Unexpected block statement surrounding arrow body’, and links to http://eslint.org/docs/rules/arrow-body-style as an explanation.
I do not understand what it wants me to change. Can someone provide some clarification?
Thanks so much.
Tat