{"id":518,"date":"2017-08-23T17:24:15","date_gmt":"2017-08-23T08:24:15","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2017\/08\/23\/react-react_router-redux-saga-superagent_bootstrap\/"},"modified":"2017-08-23T17:24:15","modified_gmt":"2017-08-23T08:24:15","slug":"react-react_router-redux-saga-superagent_bootstrap","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2017\/08\/23\/react-react_router-redux-saga-superagent_bootstrap\/","title":{"rendered":"React\u74b0\u5883-&gt;React Router-&gt;Redux-Saga-&gt;SuperAgent \u306b Bootstrap\u3092\u9069\u7528\u3059\u308b"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.co.jp\/UI%E3%81%BE%E3%81%A7%E6%89%8B%E3%81%AE%E5%9B%9E%E3%82%89%E3%81%AA%E3%81%84%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9E%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AEBootstrap-3%E5%AE%9F%E7%94%A8%E3%82%AC%E3%82%A4%E3%83%89-%E5%A4%A7%E6%BE%A4-%E6%96%87%E5%AD%9D\/dp\/4798135992\/ref=as_li_ss_il?ie=UTF8&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=40c4572103f0e0b288106ae68c551476\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4798135992&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=4798135992\" border=\"0\"><\/p>\n<p>React\u30a2\u30d7\u30ea\u306e\u30b9\u30b1\u30eb\u30c8\u30f3\u4f5c\u6210\u3092\u76ee\u6307\u3057\u3066\u3001\u4e00\u6b69\u4e00\u6b69\u3002<\/p>\n<ol>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2017\/08\/15\/react_1\">React \u958b\u767a\u306e\u5168\u4f53\u50cf\u3092\u628a\u63e1\u3057\u3064\u3064\u958b\u767a\u74b0\u5883\u3092\u6574\u3048\u308b<\/a>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2017\/08\/16\/react_router\">React \u306e\u5358\u7d14\u306a\u30b5\u30f3\u30d7\u30eb\u306b React Router \u3092\u9069\u7528\u3059\u308b<\/a>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2017\/08\/17\/react_react_router_redux-saga\">React \u306e\u5358\u7d14\u306a\u30b5\u30f3\u30d7\u30eb\u306b React Router \u3092\u7d44\u307f\u8fbc\u3093\u3060\u3082\u306e\u306b Redux-Saga \u3092\u9069\u7528\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2017\/08\/19\/react_react_router_redux-saga_ajax\">React \u306e\u5358\u7d14\u306a\u30b5\u30f3\u30d7\u30eb\u306b React Router \u3092\u7d44\u307f\u8fbc\u3093\u3060\u3082\u306e\u306b Redux-Saga \u3092\u9069\u7528\u3057\u305f\u3082\u306e\u304b\u3089Ajax\u901a\u4fe1\u3092\u7d44\u307f\u8fbc\u3080<\/a><\/li>\n<\/ol>\n<p><a href=\"https:\/\/getbootstrap.com\/\">Bootstrap<\/a> \u3092 React\u304b\u3089\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3001<a href=\"https:\/\/react-bootstrap.github.io\/\">React-Bootstrap<\/a> \u3092\u5c0e\u5165\u3059\u308b\u3002<\/p>\n<h2>1.\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>Bootstrap\u306f\u3001jQuery\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u304c\u3001\u3053\u3053\u3067jQuery\u3092\u5c0e\u5165\u3057\u3066\u3057\u307e\u3046\u3068\u3001jQuery\u306eDOM\u64cd\u4f5c\u3068\u304b\u306f\u4e0d\u8981\u306a\u306e\u3067\u3001Ajax\u901a\u4fe1\u306e\u307f\u306eSuperAgent\u3092\u5c0e\u5165\u3057\u305f\u306e\u306b\u3001\u306a\u3093\u3060\u304b\u306a\u3041\u306a\u611f\u3058\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3068\u3053\u308d\u3060\u304c\u3001\u3001\u3001<\/p>\n<p><a title=\"https:\/\/react-bootstrap.github.io\/getting-started.html\n\" href=\"https:\/\/react-bootstrap.github.io\/getting-started.html\">https:\/\/react-bootstrap.github.io\/getting-started.html<\/a><\/p>\n<blockquote>\n<p>React-Bootstrap is a complete re-implementation of the Bootstrap components using React. It has no dependency on either bootstrap.js or jQuery. If you have React setup and React-Bootstrap installed you have everything you need.<br \/>\nYou can consume the library as CommonJS modules, ES6 modules via Babel, AMD, or as a global JS script.<\/p>\n<\/blockquote>\n<p>React-Bootstrap\u3067\u306f\u3001React\u3092\u4f7f\u7528\u3057\u3066\u3001Bootstrap\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5b8c\u5168\u306b\u518d\u5b9f\u88c5\u3057\u3066\u3044\u308b\u3068\u306e\u3053\u3068\u3002bootstrap.js \u306b\u3082\u3001jQuery\u306b\u3082\u4f9d\u5b58\u3057\u3066\u3044\u306a\u304f\u3066\u3001React \u3068 React-Bootstrap\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308c\u3070\u3001\u5341\u5206\u3089\u3057\u3044\u3002\u5b89\u5fc3\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff01<\/p>\n<pre class=\"prettyprint linenums\">npm install --save react-bootstrap\r\n<\/pre>\n<h2>2.\u5b9f\u88c5<\/h2>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4e0a\u8a18 Ajax\u901a\u4fe1\u3092\u7d44\u307f\u8fbc\u3093\u3060\u72b6\u614b\u306b\u3001\u5909\u66f4\u3092\u52a0\u3048\u3066\u307f\u308b\u3002<\/p>\n<p><a title=\"https:\/\/github.com\/pppiroto\/react_get_start\/releases\" href=\"https:\/\/github.com\/pppiroto\/react_get_start\/releases\">https:\/\/github.com\/pppiroto\/react_get_start\/releases<\/a><\/p>\n<h3>\/index.html<\/h3>\n<p>\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u5f93\u3044\u3001HTML\u304b\u3089\u3001CSS\u3092 CDN\u3092\u53c2\u7167\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">&lt;!doctype html&gt;\r\n&lt;html&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=\"utf-8\"&gt;\r\n        &lt;!-- Latest compiled and minified CSS --&gt;\r\n        &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/latest\/css\/bootstrap.min.css\"&gt;\r\n        &lt;!-- Optional theme --&gt;\r\n        &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/latest\/css\/bootstrap-theme.min.css\"&gt;\r\n        &lt;title&gt;Reac Get Start&lt;\/title&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body&gt;\r\n        &lt;div id=\"root\"&gt;&lt;\/div&gt;\r\n        &lt;script src=\".\/dist\/bundle.js\"&gt;&lt;\/script&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h3>\/container\/app.js<\/h3>\n<p>react-bootstrap \u304b\u3089\u3001Grid, Row, Col \u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u3001Bootstrap\u306e \u30b0\u30ea\u30c3\u30c9\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u8a18\u8ff0\u3067\u304d\u308b\u3002\u3053\u308c\u306f\u308f\u304b\u308a\u3088\u3044\uff01<\/p>\n<p>\u307e\u305f\u3001button \u2013&gt; Button \u3068\u3059\u308b\u3053\u3068\u3067\u3001Bootstrap \u306e\u30dc\u30bf\u30f3\u306b\u5909\u66f4\u3002<\/p>\n<blockquote>\n<p>&nbsp; Nav\u3001NavItem \u3068\u3001React-Router \u306e Link \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3069\u3046\u5408\u308f\u305b\u3066\u5229\u7528\u3057\u305f\u3089\u3088\u3044\u306e\u304b\u304c\u3001\u8ab2\u984c\u3002\u305d\u3082\u305d\u3082\u3001React\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u5408\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u304b\uff1f<\/p>\n<p>&lt;Nav btStyle=\u201dtabs\u201d&gt;<\/p>\n<p>&nbsp;&nbsp;&nbsp; &lt;NavItem&gt;&lt;Link to=\u201d..\u201d&gt;hoge&lt;\/Link&gt;&lt;\/NaviItem&gt;<\/p>\n<p>&lt;\/Nav&gt;<\/p>\n<p>\u3068\u3059\u308b\u3068\u3001\u30bf\u30d6\u306e\u3046\u3061\u3001\u6587\u5b57\u306e\u90e8\u5206\u304c\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af\u306b\u306a\u3063\u3066\u3001\u305d\u3053\u3092\u9078\u629e\u3057\u306a\u3044\u3068(\u30bf\u30d6\u5168\u4f53\u3067\u306f\u3060\u3081) \u9077\u79fb\u3057\u306a\u3044\u3002\u3002\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001UL \u306b css class \u3092\u9069\u7528\u3059\u308b\u3068\u6a5f\u80fd\u306f\u3057\u3066\u3044\u308b\u304c\u3001\u3001\u3001 <\/p>\n<\/blockquote>\n<pre class=\"prettyprint linenums\">import React, { Component } from 'react';\r\nimport { BrowserRouter, Route, Link } from 'react-router-dom';\r\nimport { connect } from 'react-redux';\r\nimport { withRouter } from 'react-router-dom'\r\nimport { helloAction, helloApiAction } from '..\/actions';\r\nimport { \r\n  Grid, Row, Col,\r\n  Button, ButtonToolbar, \r\n  Nav, NavItem,\r\n  Alert\r\n} from 'react-bootstrap';\r\n\r\nclass Home extends Component {\r\n  handleMessage() {\r\n    this.props.dispatch(helloAction('Yes'));\r\n  }\r\n  handleMessageApi(event) {\r\n    this.props.dispatch(helloApiAction({ id: event.target.name }));\r\n  }\r\n  render() {\r\n    return (\r\n      &lt;div&gt;\r\n        &lt;h2&gt;Home&lt;\/h2&gt;\r\n        &lt;Alert bsStyle=\"info\"&gt;{this.props.hello}&lt;\/Alert&gt;\r\n        &lt;ButtonToolbar&gt;\r\n          &lt;Button onClick={this.handleMessage.bind(this)} &gt;Hello&lt;\/Button&gt;\r\n          &lt;Button bsStyle=\"primary\" name=\"successurl\" onClick={this.handleMessageApi.bind(this)} &gt;API(Sucess)&lt;\/Button&gt;\r\n          &lt;Button bsStyle=\"danger\"  name=\"failurl\" onClick={this.handleMessageApi.bind(this)} &gt;API(Fail)&lt;\/Button&gt;\r\n        &lt;\/ButtonToolbar&gt;\r\n      &lt;\/div&gt;\r\n    );\r\n  }\r\n}\r\n\r\nconst About = () =&gt; (\r\n  &lt;div&gt;&lt;h2&gt;About&lt;\/h2&gt;&lt;\/div&gt;\r\n)\r\nconst Topics = () =&gt; (\r\n  &lt;div&gt;&lt;h2&gt;Topics&lt;\/h2&gt;&lt;\/div&gt;\r\n)\r\n\r\nclass App extends Component {\r\n  render() {\r\n    return (\r\n      &lt;BrowserRouter&gt;\r\n          &lt;Grid&gt;\r\n            &lt;Row className=\"show-grid\"&gt;\r\n              &lt;Col xs={12}&gt;\r\n                  &lt;ul className=\"nav nav-tabs\"&gt;\r\n                    &lt;li&gt;&lt;Link to=\"\/\"&gt;Home&lt;\/Link&gt;&lt;\/li&gt;\r\n                    &lt;li&gt;&lt;Link to=\"\/about\"&gt;About&lt;\/Link&gt;&lt;\/li&gt;\r\n                    &lt;li&gt;&lt;Link to=\"\/topics\"&gt;Topics&lt;\/Link&gt;&lt;\/li&gt;\r\n                  &lt;\/ul&gt;\r\n              &lt;\/Col&gt;\r\n            &lt;\/Row&gt;\r\n            &lt;Row className=\"show-grid\"&gt;\r\n              &lt;Col xs={8}&gt;\r\n                {\/* http:\/\/qiita.com\/kuy\/items\/869aeb7b403ea7a8fd8a *\/}\r\n                &lt;Route exact path=\"\/\" component={connect(state =&gt; state)(Home)} \/&gt;\r\n                &lt;Route exact path=\"\/about\" component={About} \/&gt;\r\n                &lt;Route exact path=\"\/topics\" component={Topics} \/&gt;\r\n                &lt;\/Col&gt;\r\n            &lt;\/Row&gt;\r\n          &lt;\/Grid&gt;\r\n        &lt;\/BrowserRouter&gt;\r\n    );\r\n  }\r\n}\r\n\r\n\/\/ http:\/\/qiita.com\/MegaBlackLabel\/items\/df868e734d199071b883#_reference-863a1e1485bf47f046e5\r\nfunction mapStateToProps(state) {\r\n  return {\r\n          message:state.hello\r\n  };\r\n}\r\n\r\n\/\/ https:\/\/stackoverflow.com\/questions\/43350683\/react-router-uncaught-typeerror-cannot-read-property-route-of-undefined\r\n\/\/ export default withRouter(connect(mapStateToProps)(App))\r\nexport default connect(state =&gt; state)(App)\r\n<\/pre>\n<h2>3.\u5b9f\u884c<\/h2>\n<p>\u5b9f\u884c\u3057\u305f\u3068\u3053\u308d\u3002Bootstrap UI \u306b\u306a\u3063\u305f\u3088~<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/React-React-Router-Redux-Saga-SuperAgent_CA40\/react_bootstrap01.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"398\" height=\"411\" title=\"react_bootstrap01\" style=\"display: inline; background-image: none;\" alt=\"react_bootstrap01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/React-React-Router-Redux-Saga-SuperAgent_CA40\/react_bootstrap01_thumb.jpg\" border=\"0\"><\/a><\/p>\n<p>\u3088\u3057\u3002\u6b21\u3002<\/p>\n<p><a href=\"https:\/\/www.amazon.co.jp\/Bootstrap%E3%83%95%E3%82%A1%E3%83%BC%E3%82%B9%E3%83%88%E3%82%AC%E3%82%A4%E3%83%89-CSS%E8%A8%AD%E8%A8%88%E3%81%AE%E6%89%8B%E9%96%93%E3%82%92%E5%A4%A7%E5%B9%85%E3%81%AB%E5%89%8A%E6%B8%9B-%E7%9B%B8%E6%BE%A4-%E8%A3%95%E4%BB%8B\/dp\/4877833609\/ref=as_li_ss_il?_encoding=UTF8&amp;psc=1&amp;refRID=8JAB79AMMZDYSHS7MB7R&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=169f2a42e63818c2caca482c58510edb\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4877833609&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=li2&amp;o=9&amp;a=4877833609\" border=\"0\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>React\u30a2\u30d7\u30ea\u306e\u30b9\u30b1\u30eb\u30c8\u30f3\u4f5c\u6210\u3092\u76ee\u6307\u3057\u3066\u3001\u4e00\u6b69\u4e00\u6b69\u3002 React \u958b\u767a\u306e\u5168\u4f53\u50cf\u3092\u628a\u63e1\u3057\u3064\u3064\u958b\u767a\u74b0\u5883\u3092\u6574\u3048\u308b React \u306e\u5358\u7d14\u306a\u30b5\u30f3\u30d7\u30eb\u306b React Router \u3092\u9069\u7528\u3059\u308b React \u306e\u5358\u7d14\u306a\u30b5\u30f3\u30d7\u30eb\u306b Reac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[99],"tags":[],"class_list":["post-518","post","type-post","status-publish","format-standard","hentry","category-react"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=518"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/518\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}