GraphQL

文章目录
  1. 1. query
  2. 2. mutation
  3. 3. apollo-client

参考资料

query

用于获取信息

query {
getBox {
width
height
color
}
}

{
"data": {
"getBox": {
"width": 100,
"height": 200,
"color": "white"
}
}
}

mutation

用于修改信息

mutation {
setWidth(width: 108) {
width
height
color
}
}

{
"data": {
"setWidth": {
"width": 108,
"height": 200,
"color": "white"
}
}
}

apollo-client

https://github.com/apollographql/apollo-client

核心是内置了cache逻辑