graphql - 在 GraphQl 中定义解析器
问题描述
我刚刚开始学习 GraphQl 并遇到了解析器。我们可以在解析器中使用普通函数和箭头函数。
有什么特别的原因为什么我们会使用一个而不是另一个?两者似乎都工作正常。使用普通函数或箭头函数有什么好处吗?
// Using Arrow Functions
me: () => {
return {
id: '122',
name: 'lorem',
email: 'lorem@ipsum.com',
age: null
// Using Normal Function
me(){
return {
id: '122',
name: 'lorem',
email: 'lorem@ipsum.com',
age: null
哪一种是首选的方法?
解决方案
推荐阅读
- php - 用它们的键查找重复值
- java - 如何在android的一个recyclerview中实现多个视图
- python - django 频道私聊
- java - 无法使用 Java Jira Rest Client 更新 jira 中问题的单选字段
- amazon-web-services - K8s cronjob 一天没有正确安排好几次
- javascript - 删除特定对象后,从数组中的对象中设置新序列
- php - 身份验证页面没有在 laravel 中获取 css
- python-3.x - 迭代时更新 pandas 中的数据框
- symfony - 多文件上传约束
- visual-studio-extensions - 从 Visual Studio 访问时,Visual Studio 私有库 atom.xml 会引发错误