2024年1月26日发(作者:)
import * as constants from '../constants/index'export interface IIncrement{ type:ENT}export interface IDecrement{ type:ENT}export type EnthusiamAction=IIncrement | IDecrement;export function increment():EnthusiamAction{ return { type:ENT }}export function decrement():EnthusiamAction{ return { type:ENT }}reducers下的:import {EnthusiamAction} from '../actions'import { IStoreState } from '../types/index';import {INCREMENT,DECREMENT} from '../constants/index'export function count(state:IStoreState={count:0},action:EnthusiamAction){ switch() { case INCREMENT: return { count:+1 }
case DECREMENT: return{ count:-1 }
default: return state }}store下的:import {createStore} from 'redux'import {count} from '../reducers/index'import {composeWithDevTools} from 'redux-devtools-extension'const store = createStore(count,composeWithDevTools());export default store;:
// te({ // count:5 // }); } click() { te({ count:7 }); } send() { ('111'); k('ahh'); } increment() { ent() } decrement() { ent() } render() { return(
发布评论