You need to use this
keyword. Try this:
useImperativeHandle (ref, ()=> ({
checkSome(prop) {
userIds.push(prop.id);
if (prop.children == null) return;
prop.children.forEach((el) => {
this.checkSome(el);
});
}}));
You can read more from here.
CLICK HERE to find out more related problems solutions.