{"size": 354, "ext": "js", "max_stars_repo_path": "src/hooks/useArticleSummary.js", "max_stars_repo_name": "Alik-Kumar-Ghosh/wikipedia-kaios", "max_stars_repo_stars_event_min_datetime": "2019-10-27T10:44:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T03:08:11.000Z", "max_issues_repo_path": "src/hooks/useArticleSummary.js", "max_issues_repo_name": "Alik-Kumar-Ghosh/wikipedia-kaios", "max_issues_repo_issues_event_min_datetime": "2019-10-24T14:42:35.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-07T19:43:19.000Z", "max_forks_repo_path": "src/hooks/useArticleSummary.js", "max_forks_repo_name": "Alik-Kumar-Ghosh/wikipedia-kaios", "max_forks_repo_forks_event_min_datetime": "2019-10-24T09:31:02.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-21T20:33:35.000Z"}
{"max_stars_count": 61, "max_issues_count": 195, "max_forks_count": 23, "avg_line_length": 23.6, "max_line_length": 59, "alphanum_fraction": 0.6807909605}
import { useState, useEffect } from 'preact/hooks'
import { getArticleSummary } from 'api'

export const useArticleSummary = (lang, title) => {
  const [summary, setSummary] = useState()

  useEffect(() => {
    const [promise, abort] = getArticleSummary(lang, title)
    promise.then(setSummary)
    return abort
  }, [lang, title])

  return summary
}
