no message

This commit is contained in:
chenxuan
2024-04-26 14:45:29 +08:00
parent 65ea1cddaf
commit 23d8fcd27a
4 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "set PORT=9001 && react-scripts start",
"start": "set PORT=9009 && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
+6 -6
View File
@@ -8,11 +8,11 @@ import React,{Component} from 'react'
import store from '../redux/store'
import {createIncreementAction,createDecreementAction} from '../redux/count_action'
export default class Count extends Component{
componentDidMount(){
store.subscribe(()=>{
this.setState({})
})
}
// componentDidMount(){
// store.subscribe(()=>{
// this.setState({})
// })
// }
increement=()=>{
const {value}=this.selectNumber
store.dispatch(createIncreementAction(value*1))
@@ -23,7 +23,7 @@ export default class Count extends Component{
}
increementOdd=()=>{
const {value}=this.selectNumber
const count=store.getState()
const count=store.getState().count
// console.log(count%2!==0)
if(count%2!==0){
store.dispatch({type:"increment",data:value*1})
+1 -1
View File
@@ -6,7 +6,7 @@
*/
export default function countReducer(preState=100,action){
// console.log(action)
console.log(action)
const {type,data}=action
switch(type){
case "increement":
+1 -1
View File
@@ -14,7 +14,7 @@ exports["default"] = countReducer;
function countReducer() {
var preState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
var action = arguments.length > 1 ? arguments[1] : undefined;
// console.log(action)
console.log(action);
var type = action.type,
data = action.data;