ES6 Fat Arrow and Parentheses `(…) => ({…})` [duplicate]
问题 This question already has answers here : ECMAScript 6 arrow function that returns an object (6 answers) Closed 3 years ago . I've been working through some Graph QL/React/Relay examples and I ran into some strange syntax. When defining the fields in Graph QL Objects the following syntax is used: const xType = new GraphQLObjectType({ name: 'X', description: 'A made up type for example.', fields: () => ({ field: {/*etc.*/} }) }); From what I gather this is just defining an anonymous function