├── .gitignore ├── README.MD ├── api ├── helloworld.html ├── jsx.html ├── props │ ├── replaceProps.html │ └── setProps.html ├── refs.html └── state │ ├── replaceState.html │ └── setState.html ├── diff └── diff.html ├── gitbook ├── README.md ├── SUMMARY.md ├── _book │ ├── assets │ │ ├── WechatIMG27.png │ │ └── WechatIMG28.png │ ├── gitbook │ │ ├── fonts │ │ │ └── fontawesome │ │ │ │ ├── FontAwesome.otf │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ ├── fontawesome-webfont.svg │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ └── fontawesome-webfont.woff2 │ │ ├── gitbook-plugin-fontsettings │ │ │ ├── fontsettings.js │ │ │ └── website.css │ │ ├── gitbook-plugin-highlight │ │ │ ├── ebook.css │ │ │ └── website.css │ │ ├── gitbook-plugin-lunr │ │ │ ├── lunr.min.js │ │ │ └── search-lunr.js │ │ ├── gitbook-plugin-search │ │ │ ├── lunr.min.js │ │ │ ├── search-engine.js │ │ │ ├── search.css │ │ │ └── search.js │ │ ├── gitbook-plugin-sharing │ │ │ └── buttons.js │ │ ├── gitbook.js │ │ ├── images │ │ │ ├── apple-touch-icon-precomposed-152.png │ │ │ └── favicon.ico │ │ ├── style.css │ │ └── theme.js │ ├── index.html │ ├── md │ │ ├── GraphQL.html │ │ ├── hot-reload.html │ │ ├── mobx.html │ │ ├── mock.html │ │ ├── proxy.html │ │ ├── quickStarter.html │ │ ├── react-cli.html │ │ ├── react-router-dom.html │ │ ├── redux.html │ │ └── rxjs.html │ └── search_index.json ├── assets │ ├── WechatIMG27.png │ └── WechatIMG28.png └── md │ ├── GraphQL.md │ ├── hot-reload.md │ ├── mobx.md │ ├── mock.md │ ├── proxy.md │ ├── quickStarter.md │ ├── react-cli.md │ ├── react-router-dom.md │ ├── redux.md │ └── rxjs.md ├── mobx-react-mutipage ├── .gitignore ├── config │ ├── entries.js │ ├── env.js │ ├── jest │ │ ├── cssTransform.js │ │ └── fileTransform.js │ ├── paths.js │ ├── polyfills.js │ ├── webpack.config.dev.js │ ├── webpack.config.prod.js │ └── webpackDevServer.config.js ├── mui │ ├── index.js │ └── package.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json ├── scripts │ ├── build.js │ ├── start.js │ └── test.js └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── container │ ├── DtPicker.jsx │ ├── Pullrefresh.jsx │ ├── TimerStarter.jsx │ └── TimerStarter2.jsx │ ├── css │ └── timerStarter.css │ ├── entry │ └── firstIndex.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── mui │ ├── css │ │ ├── app.css │ │ ├── feedback.css │ │ ├── icons-extra.css │ │ ├── mui.dtpicker.css │ │ ├── mui.imageviewer.css │ │ ├── mui.indexedlist.css │ │ ├── mui.listpicker.css │ │ ├── mui.min.css │ │ ├── mui.picker.all.css │ │ ├── mui.picker.css │ │ ├── mui.picker.min.css │ │ └── mui.poppicker.css │ ├── fonts │ │ └── mui.ttf │ ├── js │ │ ├── 95516.js │ │ ├── arttmpl.js │ │ ├── beecloud.js │ │ ├── city.data-3.js │ │ ├── city.data.js │ │ ├── feedback.js │ │ ├── mui.dtpicker.js │ │ ├── mui.imageViewer.js │ │ ├── mui.indexedlist.js │ │ ├── mui.js │ │ ├── mui.lazyload.img.js │ │ ├── mui.lazyload.js │ │ ├── mui.listpicker.js │ │ ├── mui.locker.js │ │ ├── mui.min.js │ │ ├── mui.picker.all.js │ │ ├── mui.picker.js │ │ ├── mui.picker.min.js │ │ ├── mui.poppicker.js │ │ ├── mui.previewimage.js │ │ ├── mui.pullToRefresh.js │ │ ├── mui.pullToRefresh.material.js │ │ ├── mui.view.js │ │ ├── mui.zoom.js │ │ ├── update.js │ │ └── webviewGroup.js │ └── test.html │ ├── observable │ ├── App.js │ └── App2.js │ ├── pureRender │ ├── DtPicker.jsx │ ├── Pullrefresh.jsx │ └── TimerStarter.jsx │ └── registerServiceWorker.js └── my-react ├── build └── webpack.config.js ├── package.json └── src ├── index.html └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | _book 3 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | [](https://reactjs.org/) 2 | -------------------------------------------------------------------------------- /api/helloworld.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |').html(content);
65 |
66 | $link.appendTo($title);
67 | $title.appendTo($li);
68 | $content.appendTo($li);
69 | $li.appendTo($searchList);
70 | });
71 | }
72 |
73 | function launchSearch(q) {
74 | // Add class for loading
75 | $body.addClass('with-search');
76 | $body.addClass('search-loading');
77 |
78 | // Launch search query
79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS)
80 | .then(function(results) {
81 | displayResults(results);
82 | })
83 | .always(function() {
84 | $body.removeClass('search-loading');
85 | }), 1000);
86 | }
87 |
88 | function closeSearch() {
89 | $body.removeClass('with-search');
90 | $bookSearchResults.removeClass('open');
91 | }
92 |
93 | function launchSearchFromQueryString() {
94 | var q = getParameterByName('q');
95 | if (q && q.length > 0) {
96 | // Update search input
97 | $searchInput.val(q);
98 |
99 | // Launch search
100 | launchSearch(q);
101 | }
102 | }
103 |
104 | function bindSearch() {
105 | // Bind DOM
106 | $searchInput = $('#book-search-input input');
107 | $bookSearchResults = $('#book-search-results');
108 | $searchList = $bookSearchResults.find('.search-results-list');
109 | $searchTitle = $bookSearchResults.find('.search-results-title');
110 | $searchResultsCount = $searchTitle.find('.search-results-count');
111 | $searchQuery = $searchTitle.find('.search-query');
112 |
113 | // Launch query based on input content
114 | function handleUpdate() {
115 | var q = $searchInput.val();
116 |
117 | if (q.length == 0) {
118 | closeSearch();
119 | }
120 | else {
121 | launchSearch(q);
122 | }
123 | }
124 |
125 | // Detect true content change in search input
126 | // Workaround for IE < 9
127 | var propertyChangeUnbound = false;
128 | $searchInput.on('propertychange', function(e) {
129 | if (e.originalEvent.propertyName == 'value') {
130 | handleUpdate();
131 | }
132 | });
133 |
134 | // HTML5 (IE9 & others)
135 | $searchInput.on('input', function(e) {
136 | // Unbind propertychange event for IE9+
137 | if (!propertyChangeUnbound) {
138 | $(this).unbind('propertychange');
139 | propertyChangeUnbound = true;
140 | }
141 |
142 | handleUpdate();
143 | });
144 |
145 | // Push to history on blur
146 | $searchInput.on('blur', function(e) {
147 | // Update history state
148 | if (usePushState) {
149 | var uri = updateQueryString('q', $(this).val());
150 | history.pushState({ path: uri }, null, uri);
151 | }
152 | });
153 | }
154 |
155 | gitbook.events.on('page.change', function() {
156 | bindSearch();
157 | closeSearch();
158 |
159 | // Launch search based on query parameter
160 | if (gitbook.search.isInitialized()) {
161 | launchSearchFromQueryString();
162 | }
163 | });
164 |
165 | gitbook.events.on('search.ready', function() {
166 | bindSearch();
167 |
168 | // Launch search from query param at start
169 | launchSearchFromQueryString();
170 | });
171 |
172 | function getParameterByName(name) {
173 | var url = window.location.href;
174 | name = name.replace(/[\[\]]/g, '\\$&');
175 | var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)', 'i'),
176 | results = regex.exec(url);
177 | if (!results) return null;
178 | if (!results[2]) return '';
179 | return decodeURIComponent(results[2].replace(/\+/g, ' '));
180 | }
181 |
182 | function updateQueryString(key, value) {
183 | value = encodeURIComponent(value);
184 |
185 | var url = window.location.href;
186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'),
187 | hash;
188 |
189 | if (re.test(url)) {
190 | if (typeof value !== 'undefined' && value !== null)
191 | return url.replace(re, '$1' + key + '=' + value + '$2$3');
192 | else {
193 | hash = url.split('#');
194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '');
195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null)
196 | url += '#' + hash[1];
197 | return url;
198 | }
199 | }
200 | else {
201 | if (typeof value !== 'undefined' && value !== null) {
202 | var separator = url.indexOf('?') !== -1 ? '&' : '?';
203 | hash = url.split('#');
204 | url = hash[0] + separator + key + '=' + value;
205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null)
206 | url += '#' + hash[1];
207 | return url;
208 | }
209 | else
210 | return url;
211 | }
212 | }
213 | });
214 |
--------------------------------------------------------------------------------
/gitbook/_book/gitbook/gitbook-plugin-sharing/buttons.js:
--------------------------------------------------------------------------------
1 | require(['gitbook', 'jquery'], function(gitbook, $) {
2 | var SITES = {
3 | 'facebook': {
4 | 'label': 'Facebook',
5 | 'icon': 'fa fa-facebook',
6 | 'onClick': function(e) {
7 | e.preventDefault();
8 | window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href));
9 | }
10 | },
11 | 'twitter': {
12 | 'label': 'Twitter',
13 | 'icon': 'fa fa-twitter',
14 | 'onClick': function(e) {
15 | e.preventDefault();
16 | window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href));
17 | }
18 | },
19 | 'google': {
20 | 'label': 'Google+',
21 | 'icon': 'fa fa-google-plus',
22 | 'onClick': function(e) {
23 | e.preventDefault();
24 | window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href));
25 | }
26 | },
27 | 'weibo': {
28 | 'label': 'Weibo',
29 | 'icon': 'fa fa-weibo',
30 | 'onClick': function(e) {
31 | e.preventDefault();
32 | window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title));
33 | }
34 | },
35 | 'instapaper': {
36 | 'label': 'Instapaper',
37 | 'icon': 'fa fa-instapaper',
38 | 'onClick': function(e) {
39 | e.preventDefault();
40 | window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href));
41 | }
42 | },
43 | 'vk': {
44 | 'label': 'VK',
45 | 'icon': 'fa fa-vk',
46 | 'onClick': function(e) {
47 | e.preventDefault();
48 | window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href));
49 | }
50 | }
51 | };
52 |
53 |
54 |
55 | gitbook.events.bind('start', function(e, config) {
56 | var opts = config.sharing;
57 |
58 | // Create dropdown menu
59 | var menu = $.map(opts.all, function(id) {
60 | var site = SITES[id];
61 |
62 | return {
63 | text: site.label,
64 | onClick: site.onClick
65 | };
66 | });
67 |
68 | // Create main button with dropdown
69 | if (menu.length > 0) {
70 | gitbook.toolbar.createButton({
71 | icon: 'fa fa-share-alt',
72 | label: 'Share',
73 | position: 'right',
74 | dropdown: [menu]
75 | });
76 | }
77 |
78 | // Direct actions to share
79 | $.each(SITES, function(sideId, site) {
80 | if (!opts[sideId]) return;
81 |
82 | gitbook.toolbar.createButton({
83 | icon: site.icon,
84 | label: site.text,
85 | position: 'right',
86 | onClick: site.onClick
87 | });
88 | });
89 | });
90 | });
91 |
--------------------------------------------------------------------------------
/gitbook/_book/gitbook/images/apple-touch-icon-precomposed-152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adminparry/react-for-learn/0684bacab58bf93a9c8b94f4e617d6a271a77a81/gitbook/_book/gitbook/images/apple-touch-icon-precomposed-152.png
--------------------------------------------------------------------------------
/gitbook/_book/gitbook/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adminparry/react-for-learn/0684bacab58bf93a9c8b94f4e617d6a271a77a81/gitbook/_book/gitbook/images/favicon.ico
--------------------------------------------------------------------------------
/gitbook/assets/WechatIMG27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adminparry/react-for-learn/0684bacab58bf93a9c8b94f4e617d6a271a77a81/gitbook/assets/WechatIMG27.png
--------------------------------------------------------------------------------
/gitbook/assets/WechatIMG28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adminparry/react-for-learn/0684bacab58bf93a9c8b94f4e617d6a271a77a81/gitbook/assets/WechatIMG28.png
--------------------------------------------------------------------------------
/gitbook/md/GraphQL.md:
--------------------------------------------------------------------------------
1 | # GraphQL
--------------------------------------------------------------------------------
/gitbook/md/hot-reload.md:
--------------------------------------------------------------------------------
1 | # HMR 热替换
2 |
3 | ### index.tsx
4 | 默认应用使用hot-reload形式 由于前端工程的越来越大化 开发模式中我们也希望有一些状态的保留 如果reload则所有的状态都丢失了 耗时也比较长 所以应用现在比较流行也比较优秀的方式来进行开发
5 |
6 | 我们只需要在入口文件index修改其根节点就可以 这是webpack给我们带来的便利
7 |
8 | ##### ts
9 | ``` typescript
10 | import React from 'react';
11 | import ReactDOM from 'react-dom';
12 | import * as serviceWorker from '../serviceWorker';
13 |
14 | import App from './App';
15 |
16 |
17 | const rootEl = document.getElementById('root');
18 |
19 | ReactDOM.render(.
77 | // This should only be used as an escape hatch. Normally you would put
78 | // images into the `src` and `import` them in code to get their paths.
79 | PUBLIC_URL: publicUrl,
80 | }
81 | );
82 | // Stringify all values so we can feed into Webpack DefinePlugin
83 | const stringified = {
84 | 'process.env': Object.keys(raw).reduce((env, key) => {
85 | env[key] = JSON.stringify(raw[key]);
86 | return env;
87 | }, {}),
88 | };
89 |
90 | return { raw, stringified };
91 | }
92 |
93 | module.exports = getClientEnvironment;
94 |
--------------------------------------------------------------------------------
/mobx-react-mutipage/config/jest/cssTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // This is a custom Jest transformer turning style imports into empty objects.
4 | // http://facebook.github.io/jest/docs/en/webpack.html
5 |
6 | module.exports = {
7 | process() {
8 | return 'module.exports = {};';
9 | },
10 | getCacheKey() {
11 | // The output is always the same.
12 | return 'cssTransform';
13 | },
14 | };
15 |
--------------------------------------------------------------------------------
/mobx-react-mutipage/config/jest/fileTransform.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 |
5 | // This is a custom Jest transformer turning file imports into filenames.
6 | // http://facebook.github.io/jest/docs/en/webpack.html
7 |
8 | module.exports = {
9 | process(src, filename) {
10 | return `module.exports = ${JSON.stringify(path.basename(filename))};`;
11 | },
12 | };
13 |
--------------------------------------------------------------------------------
/mobx-react-mutipage/config/paths.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path');
4 | const fs = require('fs');
5 | const url = require('url');
6 |
7 | // Make sure any symlinks in the project folder are resolved:
8 | // https://github.com/facebookincubator/create-react-app/issues/637
9 | const appDirectory = fs.realpathSync(process.cwd());
10 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
11 |
12 | const envPublicUrl = process.env.PUBLIC_URL;
13 |
14 | function ensureSlash(path, needsSlash) {
15 | const hasSlash = path.endsWith('/');
16 | if (hasSlash && !needsSlash) {
17 | return path.substr(path, path.length - 1);
18 | } else if (!hasSlash && needsSlash) {
19 | return `${path}/`;
20 | } else {
21 | return path;
22 | }
23 | }
24 |
25 | const getPublicUrl = appPackageJson =>
26 | envPublicUrl || require(appPackageJson).homepage;
27 |
28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer
29 | // "public path" at which the app is served.
30 | // Webpack needs to know it to put the right