no message
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user