boot-function #1

Merged
SethTrowbridge merged 25 commits from boot-function into master 2023-06-21 07:53:14 -04:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 19cc54dcea - Show all commits

View File

@ -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)=>
{

View File

@ -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>