useUnmount function

void useUnmount(
  1. void effect()
)

Implementation

void useUnmount(void Function() effect) {
  useEffect(
    () {
      return () {
        effect();
      };
    },
    [],
  );
}