{"size": 280, "ext": "js", "max_stars_repo_path": "hooks/useClickOutside.js", "max_stars_repo_name": "yashwankhade/code-type", "max_stars_repo_stars_event_min_datetime": "2021-10-30T20:21:25.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T07:56:35.000Z", "max_issues_repo_path": "hooks/useClickOutside.js", "max_issues_repo_name": "yashwankhade/code-type", "max_issues_repo_issues_event_min_datetime": "2021-10-30T16:48:07.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-17T10:07:41.000Z", "max_forks_repo_path": "hooks/useClickOutside.js", "max_forks_repo_name": "yashwankhade/code-type", "max_forks_repo_forks_event_min_datetime": "2021-12-23T18:42:10.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-13T10:23:34.000Z"}
{"max_stars_count": 29, "max_issues_count": 9, "max_forks_count": 2, "avg_line_length": 21.5384615385, "max_line_length": 57, "alphanum_fraction": 0.6678571429}
import React from "react";

function useClickOutside(ref, handler) {
  React.useEffect(() => {
    document.addEventListener("mousedown", handler);
    return () => {
      document.removeEventListener("mousedown", handler);
    };
  }, [ref]);
}

export default useClickOutside;
