{"id":1909,"date":"2019-05-13T20:23:21","date_gmt":"2019-05-13T11:23:21","guid":{"rendered":"https:\/\/lovelinux.mydns.jp\/?p=1909"},"modified":"2019-05-13T22:16:26","modified_gmt":"2019-05-13T13:16:26","slug":"apollo-server%e3%80%81graphql%e3%80%81nodejs%e3%80%81sequesize%e3%80%81%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%81%abreactredux%e3%81%a7-%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%83%a1%e3%83%b3-3","status":"publish","type":"post","link":"https:\/\/lovelinux.mydns.jp\/?p=1909","title":{"rendered":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4"},"content":{"rendered":"<h3>\u524d\u56de\u306b\u7d9a\u3044\u3066<\/h3>\n<p>\u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001<br \/>\n\u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002<br \/>\n\u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01<\/p>\n<p>\u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n<p><font size=\"+1\"><\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/?p=1867\">\u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067<\/a><\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/?p=1896\">\u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b<\/a><\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/?p=1905\">\u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b<\/a><\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/?p=1909\">\u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09<\/a><\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/?p=1920\">\u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b<\/a><\/p>\n<p><\/font><\/p>\n<h3>GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210<\/h3>\n<p>GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\n\u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\nRedux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>[bash]<br \/>\n$ nano containers\/cproduct.js<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\nimport {connect} from &#8220;react-redux&#8221;;<br \/>\nimport {GraphQLClient} from &#8220;graphql-request&#8221;;<\/p>\n<p>import Product from &#8220;..\/components\/product&#8221;;<br \/>\nimport {set_list_body, set_has_more} from &#8220;..\/actions\/product&#8221;;<\/p>\n<p>const GET_PRODUCTS = `<br \/>\n  query GetProducts ($offset: Int!, $limit: Int!){<br \/>\n    getProducts(offset: $offset, limit: $limit){<br \/>\n      has_more<br \/>\n      products {<br \/>\n        id<br \/>\n        product_name<br \/>\n        price<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n`;<\/p>\n<p>const HOST_ADDR = &#8220;http:\/\/localhost:4000&#8221;;<br \/>\nlet LIST_OFFSET = 0;<br \/>\nlet LIST_LIMIT = 100;<\/p>\n<p>const mapStateToProps = (state) => {<br \/>\n  return {<br \/>\n    list_body: state.product.list_body,<br \/>\n    has_more: state.product.has_more,<br \/>\n  }<br \/>\n}<\/p>\n<p>const mapDispatchToProps = (dispatch) => {<br \/>\n  return {<br \/>\n    onInit: () => {<br \/>\n      LIST_OFFSET = 0;<br \/>\n      onLoadData(LIST_OFFSET, [], dispatch)<br \/>\n    },<br \/>\n    onAddNew: (history) => {<br \/>\n      history.push(&#8220;\/product\/add\/none&#8221;)<br \/>\n    },<br \/>\n    onLoadMore: (list_body) => {<br \/>\n      onLoadData(LIST_OFFSET, list_body, dispatch)<br \/>\n    },<\/p>\n<p>  }<br \/>\n}<\/p>\n<p>const onLoadData = (offset, list_body, dispatch) => {<\/p>\n<p>  const client = createClient();<br \/>\n  let variables = {offset: offset , limit: LIST_LIMIT};<\/p>\n<p>  client.request(GET_PRODUCTS, variables).then(data => {<br \/>\n    let newList = list_body;<br \/>\n    for (let i=0; i < data.getProducts.products.length; i++){\n      newList = newList.concat(data.getProducts.products[i]);\n    }\n\n    dispatch(set_list_body(newList));\n\n    LIST_OFFSET += LIST_LIMIT;\n    dispatch(set_has_more(data.getProducts.has_more));\n\n  })\n\n}\n\n\nconst createClient =() => {<br \/>\n  const client = new GraphQLClient(HOST_ADDR + &#8220;\/graphql&#8221;, {<br \/>\n    headers: {<br \/>\n      &#8220;x-token&#8221;: &#8220;test-test&#8221;,<br \/>\n    },<br \/>\n  });<\/p>\n<p>  return client;<br \/>\n}<\/p>\n<p>const CProduct = connect(mapStateToProps, mapDispatchToProps)(Product)<\/p>\n<p>export default CProduct<\/p>\n<p>[\/bash]<\/p>\n<h3>\u30da\u30fc\u30b8\u8868\u793a\u6642\u306b\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h3>\n<p>\u30da\u30fc\u30b8\u3092\u69cb\u6210\u3059\u308b product.js\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u3001componentDidMount\u304b\u3089\u3001<br \/>\ncontainer\u306e onInit\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n$ nano components\/product.js<br \/>\n[\/bash]<\/p>\n<p>componentDidMount\u3000\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\nimport React from &#8220;react&#8221;;<br \/>\nimport Menu from &#8220;.\/menu&#8221;;<\/p>\n<p>class Product extends React.Component {<br \/>\n  componentDidMount() {<br \/>\n    this.props.onInit();<br \/>\n  }<br \/>\n  render(){<br \/>\n    return (<\/p>\n<div>\n        <Menu \/><\/p>\n<h3>This is Product<\/h3>\n<\/p><\/div>\n<p>    )<br \/>\n  }<br \/>\n}<\/p>\n<p>export default Product;<br \/>\n[\/bash]<\/p>\n<h3>App.js\u306e\u8abf\u6574<\/h3>\n<p>\u30b3\u30f3\u30c6\u30ca\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u304c\u3001\u4f5c\u6210\u3057\u305f\u3060\u3051\u3067\u306f\u5229\u7528\u3055\u308c\u306a\u3044\u306e\u3067\u3001<br \/>\nproduct.js\u306e\u4ee3\u308f\u308a\u306b\u3001cproduct.js\u3092\u5229\u7528\u3059\u308b\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n$nano App.js<br \/>\n[\/bash]<\/p>\n<p>components\/product.js \u3067\u306f\u306a\u304f\u3001 \u30b3\u30f3\u30c6\u30ca\u5074\u306e containers\/cproduct.js \u3092\u53c2\u7167\u3057\u307e\u3059\u3002<\/p>\n<p>[bash]<\/p>\n<p>import React from &#8216;react&#8217;;<br \/>\nimport {Router, Route} from &#8220;react-router-dom&#8221;;<br \/>\nimport history from &#8216;.\/history&#8217;;<\/p>\n<p>import Home from &#8220;.\/components\/home&#8221;;<br \/>\nimport About from &#8220;.\/components\/about&#8221;;<br \/>\nimport CProduct from &#8220;.\/containers\/cproduct&#8221;;<\/p>\n<p>function App() {<br \/>\n  return (<\/p>\n<div className=\"App\">\n<h3>GraphQL \u3068 Apollo Server\u3092\u4f7f\u3063\u305f\u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9<\/h3>\n<p>      <Router history={history}><br \/>\n        <Route exact path=\"\/\" component={Home} \/><br \/>\n        <Route exact path=\"\/product\" component={CProduct} \/><br \/>\n        <Route exact path=\"\/about\" component={About} \/><\/p>\n<p>      <\/Router>\n    <\/div>\n<p>  );<br \/>\n}<\/p>\n<p>export default App;<\/p>\n<p>[\/bash]<\/p>\n<h3>\u30c7\u30fc\u30bf\u306f\u8aad\u307f\u8fbc\u307e\u308c\u308b\u304b\uff1f<\/h3>\n<p>\u3053\u308c\u3067\u3001server\u3092 npm start \u3057\u3001front \u3082 npm start \u3059\u308b\u3068<br \/>\n\u30c7\u30fc\u30bf\u304c\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002<br \/>\n\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u3066\u3001chrome\u3067\u3001\u30c7\u30d0\u30c3\u30b0\u306a\u3069\u5165\u308c\u308b\u3068\u3001\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3081\u3066\u3044\u308b\u3053\u3068\u304c\u89e3\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>\u30c7\u30fc\u30bf\u8868\u793a\u90e8\u5206\u306e\u4f5c\u6210<\/h3>\n<p>\u809d\u5fc3\u306e\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u3092\u4e00\u89a7\u8868\u793a\u3059\u308b\u3068\u3053\u308d\u304c\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u305d\u308c\u3092\u8a18\u8ff0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n$ nano components\/product.js<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\nimport React from &#8220;react&#8221;;<br \/>\nimport Menu from &#8220;.\/menu&#8221;;<\/p>\n<p>class Product extends React.Component {<br \/>\n  componentDidMount() {<br \/>\n    this.props.onInit();<br \/>\n  }<br \/>\n  render(){<br \/>\n    let {list_body, has_more} = this.props;<\/p>\n<p>    let lstBody = [];<\/p>\n<p>    for (let i = 0 ; i < list_body.length ; i++){\n      let bd = list_body[i];\n      lstBody.push(\n        \n\n<div>\n<div className=\"product_id\">{bd.id}<\/div>\n<div className=\"product_name\">{bd.product_name}<\/div>\n<div className=\"price\">{bd.price}<\/div>\n<\/p><\/div>\n<p>      );<br \/>\n    }<\/p>\n<p>    return (<\/p>\n<div>\n        <Menu \/><\/p>\n<h3>This is Product<\/h3>\n<div className=\"list_products\">\n          {lstBody}\n        <\/div>\n<\/p><\/div>\n<p>    )<br \/>\n  }<br \/>\n}<\/p>\n<p>export default Product;<br \/>\n[\/bash]<\/p>\n<p>\u3053\u308c\u3067\u3001\u56f3\u306e\u3088\u3046\u306b\u4e00\u89a7\u8868\u793a\u3067\u304d\u3066\u3044\u305f\u3089OK\u3067\u3059\u3002<\/p>\n<h3>CSS\u3092\u4f5c\u6210\u3057\u3066\u3001\u30c7\u30b6\u30a4\u30f3\u3092\u307e\u3068\u3082\u306b<\/h3>\n<p>\u3042\u3068\u306fSCSS\u3067\u3000\u30c7\u30b6\u30a4\u30f3\u8abf\u6574\u3092\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>[bash]<br \/>\n$ npm install &#8211;save node-sass<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\n$ nano sass\/main.scss<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\ndiv.list_products {<br \/>\n  div.product_id {<br \/>\n    float: left;<br \/>\n    width: 90px;<br \/>\n  }<br \/>\n  div.product_name {<br \/>\n    float: left;<br \/>\n    width: 250px;<br \/>\n  }<br \/>\n  div.price {<br \/>\n    float: left;<br \/>\n    width: 120px;<br \/>\n    text-align: right;<br \/>\n  }<br \/>\n  div.edit {<br \/>\n    float: left;<br \/>\n    width: 100px;<br \/>\n  }<br \/>\n  div.clearfix {<br \/>\n    clear: both;<br \/>\n  }<br \/>\n}<br \/>\n[\/bash]<\/p>\n<h4>App.js\u3092\u7de8\u96c6\u3057\u3066\u3001\u4f5c\u6210\u3057\u305fscss\u3092\u8aad\u307f\u8fbc\u3080<\/h4>\n<p>[bash]<br \/>\n$ nano App.js<br \/>\n[bash]<\/p>\n<p>[bash]<br \/>\nimport &#8220;.\/sass\/main.scss&#8221;;<\/p>\n<p>function App() {<\/p>\n<p>[\/bash]<\/p>\n<h4>\u30dc\u30bf\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u3001\u30c7\u30fc\u30bf\u3092\u7de8\u96c6\u3067\u304d\u308b\u3088\u3046\u306b<\/h4>\n<p>[bash]<br \/>\n$ nano components\/product.js<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\nimport React from &#8220;react&#8221;;<br \/>\nimport Menu from &#8220;.\/menu&#8221;;<\/p>\n<p>class Product extends React.Component {<br \/>\n  componentDidMount() {<br \/>\n    this.props.onInit();<br \/>\n  }<br \/>\n  render(){<br \/>\n    let {list_body, has_more, onClickEdit} = this.props;<\/p>\n<p>    let lstBody = [];<\/p>\n<p>    for (let i = 0 ; i < list_body.length ; i++){\n      let bd = list_body[i];\n      lstBody.push(\n        \n\n<div>\n<div className=\"product_id\">{bd.id}<\/div>\n<div className=\"product_name\">{bd.product_name}<\/div>\n<div className=\"price\">{bd.price}<\/div>\n<div className=\"edit\"><button onClick={()=> onClickEdit(bd.id)}>\u7de8\u96c6<\/button> <\/div>\n<div className=\"clearfix\" \/>\n        <\/div>\n<p>      );<br \/>\n    }<\/p>\n<p>    return (<\/p>\n<div>\n        <Menu \/><\/p>\n<h3>This is Product<\/h3>\n<div className=\"list_products\">\n          {lstBody}\n        <\/div>\n<\/p><\/div>\n<p>    )<br \/>\n  }<br \/>\n}<\/p>\n<p>export default Product;<br \/>\n[\/bash]<\/p>\n<p>\u304a\u75b2\u308c\u3055\u307e\u3067\u3057\u305f\u3002\u3068\u308a\u3042\u3048\u305a\u3001\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3001\u4e00\u89a7\u30c7\u30fc\u30bf\u304c\u8868\u793a\u3067\u304d\u308c\u3070\u6210\u529f\u3067\u3059\u3002<br \/>\n\u6b21\u56de\u306f\u3001\u4e00\u89a7\u753b\u9762\u304b\u3089\u3001\u30dc\u30bf\u30f3\u30af\u30ea\u30c3\u30af\u3067\u3001\u5225\u753b\u9762\u3092\u8868\u793a\u3057\u3001\u30c7\u30fc\u30bf\u306e\u7de8\u96c6\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><a href=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-13-00-31-18.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-13-00-31-18.png\" alt=\"Screenshot from 2019-05-13 00-31-18\" width=\"993\" height=\"680\" class=\"alignnone size-full wp-image-1882\" srcset=\"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-13-00-31-18.png 993w, https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-13-00-31-18-300x205.png 300w, https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-13-00-31-18-768x526.png 768w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from &#8220;react-redux&#8221;; import {GraphQLClient} from &#8220;graphql-request&#8221;; import Product from &#8220;..\/components\/product&#8221;; import {set_list_body, set_has_more} from &#8220;..\/actions\/product&#8221;; const GET_PRODUCTS = ` query GetProducts ($offset: Int!, $limit: Int!){ getProducts(offset: $offset, limit: $limit){ has_more products { id product_name price } } } `; const HOST_ADDR = &#8220;http:\/\/localhost:4000&#8221;; let LIST_OFFSET = 0; let LIST_LIMIT = 100; const mapStateToProps = (state) => { return { list_body: state.product.list_body, has_more: state.product.has_more, } } const mapDispatchToProps = (dispatch) => { return { onInit: () => { LIST_OFFSET = 0; onLoadData(LIST_OFFSET, [], dispatch) }, onAddNew: (history) => { history.push(&#8220;\/product\/add\/none&#8221;) }, onLoadMore: (list_body) => { onLoadData(LIST_OFFSET, list_body, dispatch) }, } } const onLoadData = (offset, list_body, dispatch) => { const client = createClient(); let variables = {offset: offset , limit: LIST_LIMIT}; client.request(GET_PRODUCTS, variables).then(data => { let newList = list_body; for (let i=0; i < data.getProducts.products.length; i++){ newList = newList.concat(data.getProducts.products[i]); } dispatch(set_list_body(newList)); LIST_OFFSET += LIST_LIMIT; dispatch(set_has_more(data.getProducts.has_more)); }) } const createClient =() => { const client = new GraphQLClient(HOST_ADDR + &#8220;\/graphql&#8221;, { headers: { &#8220;x-token&#8221;: &#8220;test-test&#8221;, }, }); return client; } const CProduct = connect(mapStateToProps, mapDispatchToProps)(Product) export default CProduct [\/bash] \u30da\u30fc\u30b8\u8868\u793a\u6642\u306b\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b \u30da\u30fc\u30b8\u3092\u69cb\u6210\u3059\u308b product.js\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u3001componentDidMount\u304b\u3089\u3001 container\u306e onInit\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002 [bash] $ nano components\/product.js [\/bash] componentDidMount\u3000\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002 [bash] import React from &#8220;react&#8221;; import Menu from &#8220;.\/menu&#8221;; class Product extends React.Component { componentDidMount() { this.props.onInit(); } render(){ return ( This is Product ) } } export default Product; [\/bash] App.js\u306e\u8abf\u6574 \u30b3\u30f3\u30c6\u30ca\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u304c\u3001\u4f5c\u6210\u3057\u305f\u3060\u3051\u3067\u306f\u5229\u7528\u3055\u308c\u306a\u3044\u306e\u3067\u3001 product.js\u306e\u4ee3\u308f\u308a\u306b\u3001cproduct.js\u3092\u5229\u7528\u3059\u308b\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002 [bash] $nano App.js [\/bash] components\/product.js \u3067\u306f\u306a\u304f\u3001 \u30b3\u30f3\u30c6\u30ca\u5074\u306e containers\/cproduct.js \u3092\u53c2\u7167\u3057\u307e\u3059\u3002 [bash] import React from &#8216;react&#8217;; import {Router, Route} from &#8220;react-router-dom&#8221;; import history from &#8216;.\/history&#8217;; import Home from &#8220;.\/components\/home&#8221;; import About from &#8220;.\/components\/about&#8221;; import&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1914,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[77],"tags":[102,101,86],"class_list":{"0":"post-1909","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-react","8":"tag-apollo","9":"tag-graphql","10":"tag-react"},"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from &quot;react-redux&quot;; import {GraphQLClient} from &quot;graphql-request&quot;; import Product from\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"hiroshi\"\/>\n\t<meta name=\"google-site-verification\" content=\"fo5n0bjUdcitu1FsBTJqqwL580wBLhhCM51IEogDt9Y\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/lovelinux.mydns.jp\/?p=1909\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_GB\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Love Linux | enjoy using linux for programming flatform\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4\" \/>\n\t\t<meta property=\"og:description\" content=\"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from &quot;react-redux&quot;; import {GraphQLClient} from &quot;graphql-request&quot;; import Product from\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/lovelinux.mydns.jp\/?p=1909\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-05-13T11:23:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-05-13T13:16:26+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4\" \/>\n\t\t<meta name=\"twitter:description\" content=\"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from &quot;react-redux&quot;; import {GraphQLClient} from &quot;graphql-request&quot;; import Product from\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#article\",\"name\":\"Apollo Server\\u3001GraphQL\\u3001nodejs\\u3001sequesize\\u3001\\u30d5\\u30ed\\u30f3\\u30c8\\u306bReact+Redux\\u3067 \\u30de\\u30b9\\u30bf\\u30fc\\u30e1\\u30f3\\u30c6\\u30ca\\u30f3\\u30b9\\u3092\\u4f5c\\u308d\\u3046! \\u301cVol.4\",\"headline\":\"Apollo Server\\u3001GraphQL\\u3001nodejs\\u3001sequesize\\u3001\\u30d5\\u30ed\\u30f3\\u30c8\\u306bReact+Redux\\u3067 \\u30de\\u30b9\\u30bf\\u30fc\\u30e1\\u30f3\\u30c6\\u30ca\\u30f3\\u30b9\\u3092\\u4f5c\\u308d\\u3046! \\u301cVol.4\",\"author\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/catch.png\",\"width\":1178,\"height\":449},\"datePublished\":\"2019-05-13T20:23:21+09:00\",\"dateModified\":\"2019-05-13T22:16:26+09:00\",\"inLanguage\":\"en-GB\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#webpage\"},\"articleSection\":\"React, Apollo, GraphQL, react\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/lovelinux.mydns.jp\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=2#listItem\",\"name\":\"\\u30d7\\u30ed\\u30b0\\u30e9\\u30df\\u30f3\\u30b0\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=2#listItem\",\"position\":2,\"name\":\"\\u30d7\\u30ed\\u30b0\\u30e9\\u30df\\u30f3\\u30b0\",\"item\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=2\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=77#listItem\",\"name\":\"React\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=77#listItem\",\"position\":3,\"name\":\"React\",\"item\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=77\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#listItem\",\"name\":\"Apollo Server\\u3001GraphQL\\u3001nodejs\\u3001sequesize\\u3001\\u30d5\\u30ed\\u30f3\\u30c8\\u306bReact+Redux\\u3067 \\u30de\\u30b9\\u30bf\\u30fc\\u30e1\\u30f3\\u30c6\\u30ca\\u30f3\\u30b9\\u3092\\u4f5c\\u308d\\u3046! \\u301cVol.4\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=2#listItem\",\"name\":\"\\u30d7\\u30ed\\u30b0\\u30e9\\u30df\\u30f3\\u30b0\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#listItem\",\"position\":4,\"name\":\"Apollo Server\\u3001GraphQL\\u3001nodejs\\u3001sequesize\\u3001\\u30d5\\u30ed\\u30f3\\u30c8\\u306bReact+Redux\\u3067 \\u30de\\u30b9\\u30bf\\u30fc\\u30e1\\u30f3\\u30c6\\u30ca\\u30f3\\u30b9\\u3092\\u4f5c\\u308d\\u3046! \\u301cVol.4\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?cat=77#listItem\",\"name\":\"React\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?author=1#author\",\"url\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?author=1\",\"name\":\"hiroshi\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e7c5ca03ae8cd5b5d36ac0f62f59c26d34fd667afa57dafb4978790c04c5146f?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"hiroshi\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#webpage\",\"url\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909\",\"name\":\"Apollo Server\\u3001GraphQL\\u3001nodejs\\u3001sequesize\\u3001\\u30d5\\u30ed\\u30f3\\u30c8\\u306bReact+Redux\\u3067 \\u30de\\u30b9\\u30bf\\u30fc\\u30e1\\u30f3\\u30c6\\u30ca\\u30f3\\u30b9\\u3092\\u4f5c\\u308d\\u3046! \\u301cVol.4\",\"description\":\"\\u524d\\u56de\\u306b\\u7d9a\\u3044\\u3066 \\u3055\\u3066\\u3001\\u3053\\u3053\\u304b\\u3089\\u304c\\u672c\\u756a\\u3067\\u3059\\u3002\\u672c\\u6765\\u306a\\u3089\\u3070 Apollo Client\\u3092\\u4f7f\\u3046\\u3079\\u304d\\u306a\\u306e\\u304b\\u3082\\u3057\\u308c\\u307e\\u305b\\u3093\\u304c\\u3001 \\u79c1\\u306e\\u500b\\u4eba\\u7684\\u306a\\u898b\\u89e3\\u3067\\u306f Apollo Client \\u306f\\u76f8\\u5f53\\u4f7f\\u3044\\u3065\\u3089\\u3044\\u3067\\u3059\\u3002 \\u306a\\u306e\\u3067\\u3001 graphql-request \\u3068\\u3044\\u3046\\u30d1\\u30c3\\u30b1\\u30fc\\u30b8\\u3092\\u4f7f\\u3063\\u3066\\u3001 GraphQL\\u306e Query\\u3068Mutaion\\u3092\\u884c\\u3044\\u307e\\u3059\\u3002 \\u30b5\\u30fc\\u30d0\\u30fc\\u30b5\\u30a4\\u30c9\\u306f GraphQL\\u306e\\u30ea\\u30af\\u30a8\\u30b9\\u30c8\\u3055\\u3048\\u98db\\u3093\\u3067\\u304f\\u308c\\u3070\\u51e6\\u7406\\u3067\\u304d\\u308b\\u306e\\u3067\\u305d\\u308c\\u3067\\u554f\\u984c\\u306a\\u3057\\u3067\\u3059\\uff01 \\u79c1\\u306f\\u3053\\u306e\\u3084\\u308a\\u65b9\\u304c\\u975e\\u5e38\\u306b\\u6c17\\u306b\\u5165\\u3063\\u3066\\u3044\\u307e\\u3059\\u3002 \\u3053\\u306e\\u8a18\\u4e8b\\u306f\\uff15\\u56de\\u306b\\u5206\\u3051\\u3066\\u9023\\u8f09\\u3059\\u308b\\u3001\\u7b2c\\uff14\\u56de\\u306e\\u8a18\\u4e8b\\u3067\\u3059\\u3002 \\u30fb\\u7b2c\\uff11\\u56de Apollo Server\\u304c\\u52d5\\u304f\\u3068\\u3053\\u308d\\u307e\\u3067 \\u30fb\\u7b2c\\uff12\\u56de Apollo Server\\u914d\\u4e0b\\u3067\\u3001GraphQL\\u3092\\u4f7f\\u3063\\u3066\\u5546\\u54c1\\u30de\\u30b9\\u30bf\\u30fc\\u306b\\u30a2\\u30af\\u30bb\\u30b9\\u3059\\u308b \\u30fb\\u7b2c\\uff13\\u56de \\u30d5\\u30ed\\u30f3\\u30c8\\u30a8\\u30f3\\u30c9\\u3092React\\uff0bRedux\\uff0bgraphql-request\\u3092\\u4f7f\\u3063\\u3066\\u5b9f\\u88c5\\u3059\\u308b \\u30fb\\u7b2c\\uff14\\u56de \\u30d5\\u30ed\\u30f3\\u30c8\\u30a8\\u30f3\\u30c9\\u304b\\u3089graphql-request\\u3092\\u4f7f\\u3063\\u3066\\u3001\\u30c7\\u30fc\\u30bf\\u3092\\u53d6\\u5f97\\u30fb\\u8868\\u793a\\u3059\\u308b\\uff08\\u3053\\u306e\\u8a18\\u4e8b\\uff09 \\u30fb\\u7b2c\\uff15\\u56de graphql-request\\u3092\\u4f7f\\u3063\\u3066\\u3001\\u30c7\\u30fc\\u30bf\\u3092\\u767b\\u9332\\u30fb\\u4fee\\u6b63\\u30fb\\u524a\\u9664\\u3059\\u308b GraphQL\\u30a2\\u30af\\u30bb\\u30b9\\u306e\\u4e2d\\u5fc3\\u3068\\u306a\\u308bcontainer\\u30d5\\u30a1\\u30a4\\u30eb\\u3092\\u4f5c\\u6210 GET_PRODUCTS\\u3067\\u3001\\u30c7\\u30fc\\u30bf\\u3092N\\u4ef6\\u53d6\\u5f97\\u3057\\u307e\\u3059\\u3002 \\u5b9f\\u969b\\u306b\\u306f onLoadData \\u95a2\\u6570\\u5185\\u3067 GET_PRODUCTS\\u30af\\u30a8\\u30ea\\u3067\\u3001GraphQL \\u30ea\\u30af\\u30a8\\u30b9\\u30c8\\u3092\\u884c\\u3044\\u3001\\u30c7\\u30fc\\u30bf\\u3092N\\u4ef6\\u53d6\\u5f97\\u3057\\u307e\\u3059\\u3002 Redux\\u306e container\\u306b\\u3064\\u3044\\u3066\\u3088\\u304f\\u308f\\u304b\\u3089\\u306a\\u3044\\u5834\\u5408\\u306f\\u3001\\u307f\\u3063\\u3061\\u308a\\u4e88\\u7fd2\\u3057\\u3066\\u304f\\u3060\\u3055\\u3044\\u3002 [bash] $ nano containers\\\/cproduct.js [\\\/bash] [bash] import {connect} from \\\"react-redux\\\"; import {GraphQLClient} from \\\"graphql-request\\\"; import Product from\",\"inLanguage\":\"en-GB\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?author=1#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/catch.png\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909\\\/#mainImage\",\"width\":1178,\"height\":449},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/?p=1909#mainImage\"},\"datePublished\":\"2019-05-13T20:23:21+09:00\",\"dateModified\":\"2019-05-13T22:16:26+09:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/#website\",\"url\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/\",\"name\":\"Love Linux\",\"description\":\"enjoy using linux for programming flatform\",\"inLanguage\":\"en-GB\",\"publisher\":{\"@id\":\"https:\\\/\\\/lovelinux.mydns.jp\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","description":"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from \"react-redux\"; import {GraphQLClient} from \"graphql-request\"; import Product from","canonical_url":"https:\/\/lovelinux.mydns.jp\/?p=1909","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"fo5n0bjUdcitu1FsBTJqqwL580wBLhhCM51IEogDt9Y","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#article","name":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","headline":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","author":{"@id":"https:\/\/lovelinux.mydns.jp\/?author=1#author"},"publisher":{"@id":"https:\/\/lovelinux.mydns.jp\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/catch.png","width":1178,"height":449},"datePublished":"2019-05-13T20:23:21+09:00","dateModified":"2019-05-13T22:16:26+09:00","inLanguage":"en-GB","mainEntityOfPage":{"@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#webpage"},"isPartOf":{"@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#webpage"},"articleSection":"React, Apollo, GraphQL, react"},{"@type":"BreadcrumbList","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp#listItem","position":1,"name":"Home","item":"https:\/\/lovelinux.mydns.jp","nextItem":{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?cat=2#listItem","name":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0"}},{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?cat=2#listItem","position":2,"name":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0","item":"https:\/\/lovelinux.mydns.jp\/?cat=2","nextItem":{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?cat=77#listItem","name":"React"},"previousItem":{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?cat=77#listItem","position":3,"name":"React","item":"https:\/\/lovelinux.mydns.jp\/?cat=77","nextItem":{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#listItem","name":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4"},"previousItem":{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?cat=2#listItem","name":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0"}},{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#listItem","position":4,"name":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","previousItem":{"@type":"ListItem","@id":"https:\/\/lovelinux.mydns.jp\/?cat=77#listItem","name":"React"}}]},{"@type":"Person","@id":"https:\/\/lovelinux.mydns.jp\/?author=1#author","url":"https:\/\/lovelinux.mydns.jp\/?author=1","name":"hiroshi","image":{"@type":"ImageObject","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/e7c5ca03ae8cd5b5d36ac0f62f59c26d34fd667afa57dafb4978790c04c5146f?s=96&d=mm&r=g","width":96,"height":96,"caption":"hiroshi"}},{"@type":"WebPage","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#webpage","url":"https:\/\/lovelinux.mydns.jp\/?p=1909","name":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","description":"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from \"react-redux\"; import {GraphQLClient} from \"graphql-request\"; import Product from","inLanguage":"en-GB","isPartOf":{"@id":"https:\/\/lovelinux.mydns.jp\/#website"},"breadcrumb":{"@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#breadcrumblist"},"author":{"@id":"https:\/\/lovelinux.mydns.jp\/?author=1#author"},"creator":{"@id":"https:\/\/lovelinux.mydns.jp\/?author=1#author"},"image":{"@type":"ImageObject","url":"https:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2019\/05\/catch.png","@id":"https:\/\/lovelinux.mydns.jp\/?p=1909\/#mainImage","width":1178,"height":449},"primaryImageOfPage":{"@id":"https:\/\/lovelinux.mydns.jp\/?p=1909#mainImage"},"datePublished":"2019-05-13T20:23:21+09:00","dateModified":"2019-05-13T22:16:26+09:00"},{"@type":"WebSite","@id":"https:\/\/lovelinux.mydns.jp\/#website","url":"https:\/\/lovelinux.mydns.jp\/","name":"Love Linux","description":"enjoy using linux for programming flatform","inLanguage":"en-GB","publisher":{"@id":"https:\/\/lovelinux.mydns.jp\/#person"}}]},"og:locale":"en_GB","og:site_name":"Love Linux | enjoy using linux for programming flatform","og:type":"article","og:title":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","og:description":"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from &quot;react-redux&quot;; import {GraphQLClient} from &quot;graphql-request&quot;; import Product from","og:url":"https:\/\/lovelinux.mydns.jp\/?p=1909","article:published_time":"2019-05-13T11:23:21+00:00","article:modified_time":"2019-05-13T13:16:26+00:00","twitter:card":"summary_large_image","twitter:title":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","twitter:description":"\u524d\u56de\u306b\u7d9a\u3044\u3066 \u3055\u3066\u3001\u3053\u3053\u304b\u3089\u304c\u672c\u756a\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 Apollo Client\u3092\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001 \u79c1\u306e\u500b\u4eba\u7684\u306a\u898b\u89e3\u3067\u306f Apollo Client \u306f\u76f8\u5f53\u4f7f\u3044\u3065\u3089\u3044\u3067\u3059\u3002 \u306a\u306e\u3067\u3001 graphql-request \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u3001 GraphQL\u306e Query\u3068Mutaion\u3092\u884c\u3044\u307e\u3059\u3002 \u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u306f GraphQL\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u3048\u98db\u3093\u3067\u304f\u308c\u3070\u51e6\u7406\u3067\u304d\u308b\u306e\u3067\u305d\u308c\u3067\u554f\u984c\u306a\u3057\u3067\u3059\uff01 \u79c1\u306f\u3053\u306e\u3084\u308a\u65b9\u304c\u975e\u5e38\u306b\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306e\u8a18\u4e8b\u306f\uff15\u56de\u306b\u5206\u3051\u3066\u9023\u8f09\u3059\u308b\u3001\u7b2c\uff14\u56de\u306e\u8a18\u4e8b\u3067\u3059\u3002 \u30fb\u7b2c\uff11\u56de Apollo Server\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067 \u30fb\u7b2c\uff12\u56de Apollo Server\u914d\u4e0b\u3067\u3001GraphQL\u3092\u4f7f\u3063\u3066\u5546\u54c1\u30de\u30b9\u30bf\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \u30fb\u7b2c\uff13\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3092React\uff0bRedux\uff0bgraphql-request\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3059\u308b \u30fb\u7b2c\uff14\u56de \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u304b\u3089graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u8868\u793a\u3059\u308b\uff08\u3053\u306e\u8a18\u4e8b\uff09 \u30fb\u7b2c\uff15\u56de graphql-request\u3092\u4f7f\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u767b\u9332\u30fb\u4fee\u6b63\u30fb\u524a\u9664\u3059\u308b GraphQL\u30a2\u30af\u30bb\u30b9\u306e\u4e2d\u5fc3\u3068\u306a\u308bcontainer\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 GET_PRODUCTS\u3067\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f onLoadData \u95a2\u6570\u5185\u3067 GET_PRODUCTS\u30af\u30a8\u30ea\u3067\u3001GraphQL \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3044\u3001\u30c7\u30fc\u30bf\u3092N\u4ef6\u53d6\u5f97\u3057\u307e\u3059\u3002 Redux\u306e container\u306b\u3064\u3044\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307f\u3063\u3061\u308a\u4e88\u7fd2\u3057\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ nano containers\/cproduct.js [\/bash] [bash] import {connect} from &quot;react-redux&quot;; import {GraphQLClient} from &quot;graphql-request&quot;; import Product from"},"aioseo_meta_data":{"post_id":"1909","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2025-08-22 21:17:57","updated":"2025-08-25 11:30:09","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lovelinux.mydns.jp\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lovelinux.mydns.jp\/?cat=2\" title=\"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\">\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lovelinux.mydns.jp\/?cat=77\" title=\"React\">React<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tApollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/lovelinux.mydns.jp"},{"label":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0","link":"https:\/\/lovelinux.mydns.jp\/?cat=2"},{"label":"React","link":"https:\/\/lovelinux.mydns.jp\/?cat=77"},{"label":"Apollo Server\u3001GraphQL\u3001nodejs\u3001sequesize\u3001\u30d5\u30ed\u30f3\u30c8\u306bReact+Redux\u3067 \u30de\u30b9\u30bf\u30fc\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3092\u4f5c\u308d\u3046! \u301cVol.4","link":"https:\/\/lovelinux.mydns.jp\/?p=1909"}],"_links":{"self":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1909"}],"version-history":[{"count":7,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1909\/revisions"}],"predecessor-version":[{"id":1936,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1909\/revisions\/1936"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/media\/1914"}],"wp:attachment":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}