Skip to content

emitter.off 不执行的问题,也没有报错 #1

Description

@andy136240860
  useEffect(() => {
    emitter.on('handleResignContract', event => { event?.data && setResignOriginContractData(event?.data); handleResignContract(); });
    return () => {      try {
        emitter.off("*", event => console.info('这里卸载了handleResignContract'));
      } catch (error) {
        console.info(error);
      }
    };
  })

切换页面之后,会产生内存泄露, emitter.on会调用多次

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions