摘要: 1 import React,{ useState,useEffect } from 'react' 2 function User(){ 3 const [date,setDate] = useState(new Date()); 4 const [date2,setDate2] = useSta 阅读全文
posted @ 2020-08-28 23:59 雪糕战士 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 解决异步: 1、nextState(推荐) import React from 'react' class Home extends React.Component{ constructor(props){ super(props); this.state = { data :0 } } compo 阅读全文
posted @ 2020-08-26 00:29 雪糕战士 阅读(1507) 评论(0) 推荐(0) 编辑
摘要: 1、下载git 2、使用git打开github文件 3、在git中执行npm install,现在时间有点长耐心点即可 阅读全文
posted @ 2020-08-10 23:50 雪糕战士 阅读(1450) 评论(0) 推荐(0) 编辑
摘要: 1 安装:cnpm i react-router-dom 2 3 4 5 <Route path='/' exact render={()=><div>home</div>}></Route> 6 7 当路径为/根路径时候显示里面的内容home,exact 表示完全配置这个路径, 8 9 例如为ht 阅读全文
posted @ 2020-07-18 22:13 雪糕战士 阅读(856) 评论(0) 推荐(0) 编辑
摘要: 文档目录 immutable使用 1、安装:cnpm i immutable 在reducer中引用 import { fromJS } from 'immutable'; const defaultState = fromJS ({ focused : false }); immutable对象s 阅读全文
posted @ 2020-07-16 22:17 雪糕战士 阅读(511) 评论(0) 推荐(0) 编辑
摘要: outline:none; 阅读全文
posted @ 2020-07-12 23:00 雪糕战士 阅读(1774) 评论(0) 推荐(0) 编辑
摘要: styled-components用法 定义样式 import styled from 'styled-components'; export const HeaderWrapper = styled.div` height:56px; background:red; ` 组件里面使用 import 阅读全文
posted @ 2020-07-12 16:58 雪糕战士 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 1、项目初始化配置 styled-components让css项目互相不干扰 cnpm i styled-components 使用方法 import { createGlobalStyle } from 'styled-components'; export const Globalstyle = 阅读全文
posted @ 2020-07-12 15:10 雪糕战士 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 安装react-redux cnpm i react-redux 文件目录 定义store文件 1 index.js文件: 2 3 import { createStore } from 'redux'; 4 import reducer from './reducer'; 5 const stor 阅读全文
posted @ 2020-07-12 00:11 雪糕战士 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 我试了很多办法,重装node升级npm,都失败了,git上发现 create-react-app myproject --use-npm能够暂时解决,但是我安装ant desig时候package.json中缺少依赖项提示有出来了,而且安装失败,后面我卸载了C:\Users\Administrato 阅读全文
posted @ 2020-07-05 19:15 雪糕战士 阅读(564) 评论(0) 推荐(0) 编辑