React Redux router Immutable Es6等框架学习要点整理

来源:互联网 发布:中国移动关闭3g网络 编辑:程序博客网 时间:2024/06/06 06:43

学习网站不错;
http://www.ruanyifeng.com/blog/2016/09/redux_tutorial_part_three_react-redux.html
http://www.ruanyifeng.com/blog/2015/03/react.html
/ES6/基础语法;
http://www.cnblogs.com/snandy/p/4403111.html
React
  1. 所有组件类都必须有自己的 render 方法,用于输出组件。
  2. 组件类的第一个字母必须大写,否则会报错,比如HelloMessage不能写成helloMessage
  3. 组件类只能包含一个顶层标签
  4. class 属性需要写成 className ,for 属性需要写成 htmlFor ,这是因为 class 和 for 是 JavaScript 的保留字
不错
论坛http://react-china.org/c/jiao-cheng
异步获取数据框架;
axios :https://github.com/svrcekmichal/redux-axios-middleware
https://www.kancloud.cn/yunye/axios/234847
//react grid例子;
https://github.com/hjzgg/webpa
//react easyui
https://reacteasyui.github.io/#/base/element?_k=gcsnr0
redux 学习的例子
https://github.com/ckinmind/apple-basket-redux
父子这个介绍的很好;
http://www.cnblogs.com/MuYunyun/p/6602433.html
学习路线
https://github.com/justjavac/free-programming-books-zh_CN
Flux入门
http://www.jianshu.com/p/d85d5ee6
对应的例子(https://coding.net/u/jevirs/p/react-flux-Todo/git)
flux 这个例子太拗口;
http://blog.csdn.net/u013063153/article/details/52513416
npm start 默认配置
http://blog.csdn.net/zzqw199012/article/details/71543071
评论
https://zhuanlan.zhihu.com/FrontendMagazine/19896745
源代码参考
分页代码参考 一般:
https://github.com/SimplyWenjing/React/blob/master/page.js
不错的代码参考
https://github.com/trazyn/ieaseMusic
https://github.com/hua1995116/react-shopping/tree/master/src
https://github.com/Tie-Dan/React
//完整的例子 可以学习
https://github.com/fireyy/react-antd-admin
//台湾人写的例子还行
https://github.com/shiningjason1989/react-quick-tutorial
其他
https://github.com/AllenFang/react-bootstrap-table
https://github.com/chvin/react-tetris
antd table 的例子不错
http://blog.csdn.net/javareact/article/details/58605302

Router 注意点
新的 API 概念:由于我们的应用程序是用于浏览器的,所以我们需要将它封装在来自 v4 的 BrowserRouter 中。还要注意的是我们现在从 react-router-dom 中导入它(这意味着我们安装的是 react-router-dom 而不是 react-router)。提示!现在叫做 react-router-dom 是因为还有一个 native 版本
对于使用 React Router v4 构建的应用程序,首先看到的是“路由”似乎丢失了。在 v3 中,路由是我们的应用程序直接呈现给 DOM 的最巨大的东西。 现在,除了 <BrowserRouter>外,我们首先抛给 DOM 的是我们的应用程序本身。
另一个在 v3 的例子中有而在 v4 中没有的是,使用 {props.children} 来嵌套组件。这是因为在 v4 中,<Route> 组件在何处编写,如果路由匹配,子组件将在那里渲染。
文章地址:http://blog.csdn.net/sinat_17775997/article/details/77411324
学习关键词
@connect 语法

es6 扩展运算符 三个点(...)
&&&
公司使用的的react.js的版本提14.7的,JS版本使用的是ES6语法,因此在使用antd过程中,有些许不愉快的记录,分享给大家,一起学习:
  1. 如果是react 14.7版本时,使用getFieldDecorator API时会后错,直接使用getFieldProps代替,即可
  2. this.props.form 中含有大量的方法,可以去这里调用
  3. 刚开始使用大部分的报错是因为antd中的方法都没有 bind(this) 绑定this,只要绑定this即可
  4. 使用antd组件不能直接export default  组件名称,必须先class,最后使用antd的方法导出组件:export default creatForm()(组件名称)
ES6 import 引用文件夹/目录
this => function 等区别
http://blog.csdn.net/daily886/article/details/53765658
//react chart 包装
https://github.com/liuhong1happy/react-raphael-chart
开源:后端nodejs做的,+微信号;
https://github.com/MuYunyun/yunban
fetch 注意要求;
亲测过的写法如下:
get请求的时候
fetch('MYURL').
then(res=>res.json()).
then(json=>dispatch(myActionName(json))).
catch(err=>dispatch(myErrActionName(err)));
POST请求的时候
fetch(‘URL’,
{
method:'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body:JSON.stringify({'data':json})
}
)
.then(res => res.json())
.then(json =>dispatch(receivePosts(json)))
.catch(error=>dispatch(requestExceptions(error)));
JSON.stringify这个很重要,否则我们的数据无法被识别为json会很痛苦。希望对您的开发有帮助

跨域问题!!!tomcat 配置,或者彻底解决在服务端做代理配置(NGINX)

<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>com.etfhr.sgeo.filter.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

https://github.com/z-hao-wang/react-native-rsa/blob/master/__tests__/index.spec.js

生命周期: