boot-function #1
@ -102,10 +102,10 @@ const ProxyState =(argNew:StateType)=>
|
||||
};
|
||||
|
||||
type Storelike = Record<string, string>
|
||||
const ProxyReducer =(inReducer:(inState:Storelike, inAction:string)=>Storelike, inState:Storelike)=>
|
||||
const ProxyReducer =(inReducer:(inState:Storelike, inAction:string)=>Storelike, inState:Storelike, inInit?:(inState:Storelike)=>Storelike)=>
|
||||
{
|
||||
const check = MapIndex(HMR.statesOld, HMR.statesNew.size);
|
||||
const argOld = check ? check[1].state : inState;
|
||||
const argOld = check ? check[1].state : (inInit ? inInit(inState) : inState);
|
||||
|
||||
const intercept =(inInterceptState:Storelike, inInterceptAction:string)=>
|
||||
{
|
||||
|
@ -24,10 +24,16 @@ const reducer =(inState:Store, inAction:number)=>
|
||||
return {...inState, age:inState.age+inAction};
|
||||
}
|
||||
|
||||
const builder =(inState:Store):Store=>
|
||||
{
|
||||
inState.age = 100;
|
||||
return inState;
|
||||
}
|
||||
|
||||
export default ()=>
|
||||
{
|
||||
|
||||
const [Store, Dispatch] = React.useReducer(reducer, {name:"seth", age:24} as Store)
|
||||
const [Store, Dispatch] = React.useReducer(reducer, {name:"seth", age:24} as Store, builder)
|
||||
return <CTXString.Provider value="intradestink">
|
||||
<div>
|
||||
<h1>Title!</h1>
|
||||
|
Loading…
Reference in New Issue
Block a user