上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 37 下一页
摘要: 1.store必须是唯一的,多个store是坚决不允许的,只能有一个store空间 现在看 TodoList.js 的代码,就可以看到,这里有一个 /store/index.js 文件,只在这个文件中用 createStore() 方法,声明了一个 store,之后整个应用都在使用这个 store。 阅读全文
posted @ 2022-06-21 01:44 SimoonJia 阅读(111) 评论(0) 推荐(0)
摘要: 1.使用actionTypes.js文件定义Type减少代码冗余,代码复用 export const CHANGE_INPUT='changeInput' export const ADD_ITEM='addItem' export const DELETE_ITEM='deleteItem' im 阅读全文
posted @ 2022-06-21 01:37 SimoonJia 阅读(36) 评论(0) 推荐(0)
摘要: export default function useCheckLogin(){ const [loginstate,setLoginState]=useState(false); let username=localStorage.getItem('user'); if(username!=nul 阅读全文
posted @ 2022-06-21 00:10 SimoonJia 阅读(35) 评论(0) 推荐(0)
摘要: import axios from "axios"; const baseUrl = "http:/123.57.50.179:8900"; const getRequest = (path, params) => { return axios.get(baseUrl + path, { param 阅读全文
posted @ 2022-06-21 00:09 SimoonJia 阅读(225) 评论(0) 推荐(0)
摘要: import localStorage from "localStorage";//引入 localStorage.setItem("userInfo", JSON.stringify(res.data.data));//存 localStorage.setItem("user", res.data 阅读全文
posted @ 2022-06-21 00:04 SimoonJia 阅读(832) 评论(0) 推荐(0)
摘要: TodoList.js import React, { Component } from 'react' import {Input,Button,List} from 'antd' import store from './store'; class TodoList extends Compon 阅读全文
posted @ 2022-06-20 23:53 SimoonJia 阅读(57) 评论(0) 推荐(0)
摘要: constructor(props){ super(props) this.state=store.getState() this.changeInputValue=this.changeInputValue.bind(this) this.storeChange=this.storeChange. 阅读全文
posted @ 2022-06-20 19:55 SimoonJia 阅读(215) 评论(0) 推荐(0)
摘要: TodoList.js import React, { Component } from 'react' import {Input,Button,List} from 'antd' import store from './store'; class TodoList extends Compon 阅读全文
posted @ 2022-06-19 02:56 SimoonJia 阅读(38) 评论(0) 推荐(0)
摘要: this的指向不对,需要用bind绑定this 例如 constructor(props){ super(props) this.state=store.getState() this.changeInputValue=this.changeInputValue.bind(this)//绑定 sto 阅读全文
posted @ 2022-06-19 02:47 SimoonJia 阅读(1397) 评论(0) 推荐(0)
摘要: 扩展商店 1.浏览器里安装redux-devtools 谷歌: edge: 2.在项目的入口文件里 找到 createStore函数调用的地方,给它加第二个参数 window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENS 阅读全文
posted @ 2022-06-19 01:40 SimoonJia 阅读(360) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 37 下一页