WJ7ERDAGF5DRTSWAGVPRAVYAQKE3HG5BTC572TUPIB5SWDHZ7MCAC
GO6HOZRQC3PVIH6REZM4MYH3PGAQD5YSW3VCFJZ6ZENJLC5KDDMAC
D7M3NFICDSC4NAYWQ6YIARDUWOVWH65FPUNT4S4SE37XLLXYSJIQC
MNDM5JIABU72FANOO5BHMBF7P5GUK4W6AHSKC3IBHZYJ4LOBXQZQC
6T6WON5JNGCRCSUUMKLMHD4D2R7NJANUNXCBL37LUQQHFMOPD5DQC
ZCLRDJQVS733WMBOJEPQR7YLZNHVA7HRPXO3XCIOFCQWNGI6PGYQC
R4BVCJBS3A27YSRW6JDKADTQIHNBRKM72OW7EHMEKCCNVHQHWJJAC
YLV4W4IIJEWLS72UPGXZAJCDTWN6SJ4UTCYOW7YDSK2DLOUTAFOAC
P55M772YOYQKCH3NKZWRGVFNULQA6K5L3SWC6M52R32QBC4VON5QC
PZOXTKMY2XASMYOY4VIGP3IEBPO55A4RU4FBZDVRRNTQA32F25ZQC
HPOKB2TCHK3MTYYKXL3DE476BF3JXVSX6MSGI5NF4PSLALTS3PHQC
> = {
childClass: new (props: ChildPropsType) => ChildInstanceType;
instance?: ChildInstanceType;
propsFactory: (
parentProps: ParentPropsType,
parentState: ParentStateType
) => ChildPropsType;
};
> = {
childClass: new (props: ChildPropsType) => ChildInstanceType;
instance?: ChildInstanceType;
propsFactory: (
parentProps: ParentPropsType,
parentState: ParentStateType
) => ChildPropsType;
};
class ChildrenArray<P extends Props, S extends State> {
private _values: ChildInstructions<any, any, P, S>[] = [];
public push<CIT, CPT>(c: ChildInstructions<CIT, CPT, P, S>) {
this._values.push(c);
}
public remove<CIT>(c: CIT) {
this._values.splice(this._values.findIndex(it => it.instance === c), 1);
}
public forEach(callbackfn: (
value: ChildInstructions<any, any, P, S>,
index: number,
array: ChildInstructions<any, any, P, S>[],
) => void) {
this._values.forEach(callbackfn);
}
}
protected _staleProps: P; // need it for args
private _children: ChildInstructions<any, any, P, S>[];
protected _staleProps: P; // NOTE(bowei): need it for args for now; maybe we can extract out args?
private _children: ChildrenArray<P, S> = new ChildrenArray();
protected updateChildren(nextProps: P) {
this._children.forEach(({ instance, propsFactory }) => {
instance._update(propsFactory(nextProps, this.state));
});
}