Recursive function in useImperativeHandle

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.

Leave a Comment

Your email address will not be published.

Scroll to Top