#this is the stuff that I've
1 messages · Page 1 of 1 (latest)
// in component
const [position, setPosition] = useState()
props.node.onUpdate = (newVal: TreeNode) => { // "subscribe"
setPosition(newVal)
}
// in class
public onUpdate: (prev: TreeNode) => void = () => {}
public setPosition(newPos: Pos){
this._position = newPos,
this.onUpdate(this)
}
gonna dump this here to make it fair for everyone
thanks
did you get it working
yes some bit of it
I never said it didn't
I was lazy to not implement it
I implemented the rendering and maintaining state
next is updating props and generating the code
ah ok mb