import React from 'react'
var obj={
? ? monitor:{
? ? ? ? list:[]
? ? }
};
export const connect =(mapStroe)=>{
? ? return function(Warp){
? ? ? ? return class extends React.PureComponent{
? ? ? ? ? ? dispatch=({key,value})=>{
? ? ? ? ? ? ? ? obj = {
? ? ? ? ? ? ? ? ? ? ...obj,
? ? ? ? ? ? ? ? ? ? monitor:{
? ? ? ? ? ? ? ? ? ? ? ? [key]:value
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? this.forceUpdate();
? ? ? ? ? ? }
? ? ? ? ? ? render(){
? ? ? ? ? ? ? ? let store = obj;
? ? ? ? ? ? ? ? if(mapStroe){
? ? ? ? ? ? ? ? ? ? mapStroe(obj);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? return (
? ? ? ? ? ? ? ? ? ? <Warp {...this.props} {...store} dispatch={this.dispatch} ></Warp>
? ? ? ? ? ? ? ? );
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
沒有寫action,沒有合并函數(shù)。本質(zhì)而言只能算是react-redux的最基本功能。