随笔分类 - react
react相关
摘要:react-redux 不能单独使用 需要配合redux一起使用 1.react-redux主要由2部分组成 Provider connect Provider中必须有一个属性 store 值为store 原理是用了context跨组件传值 connect:高阶组件 第一个函数中有2个参数(函数必须
阅读全文
摘要:fromJS:深层次转换,可以将所有的原生JS对象都转换为immutable对象 toJS:深层次转换 将immutable对象转换为原生JS对象let state = immutable.fromJS({ name:"张三", obj:{ username:"123", password:456
阅读全文
摘要:fetch 浏览器自带的一种前后端数据处理的方式 cnpm install whatwg-fetch --save fetch(url,options).then((res)=>res.json()).then((data)=>{}) 特点:第一次返回的结构不是response 而是一个未处理的re
阅读全文
摘要:render*参数1:需要渲染的DOM节点 或者组件 如何渲染的是标签则只需要写标签名称即可 如果是组件则需要按照标签的形式输写<App/>* 参数2:需要将渲染的这个节点挂载在哪里* 参数3回调 jsx语法中class需要改写成className for需要改写成htmlFor 如何创建一个组件
阅读全文
摘要:1、路由的安装 cnpm install react-router-dom -S 2、路由的方式 HashRouter: 带hash值的router vue hash BrowserRouter: 不带hash值的router vue history 注意: 1、路由的配置项必须在HashRoute
阅读全文
摘要:1、React中的生命周期有哪些? constructor componentWillMount render componentDidMount componentWillReceiveProps shouldComponentUpdate componentWillUpdate componen
阅读全文

浙公网安备 33010602011771号