{"size": 618, "ext": "js", "max_stars_repo_path": "map_deck/src/context/MapsContext.js", "max_stars_repo_name": "slnsw/dxlab-subplot", "max_stars_repo_stars_event_min_datetime": "2021-05-20T08:58:28.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-10T10:10:28.000Z", "max_issues_repo_path": "map_deck/src/context/MapsContext.js", "max_issues_repo_name": "slnsw/dxlab-subplot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "map_deck/src/context/MapsContext.js", "max_forks_repo_name": "slnsw/dxlab-subplot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.7692307692, "max_line_length": 84, "alphanum_fraction": 0.6488673139}
import React from 'react'
import { reducer } from './MainReducer'
import { thunkDispatch } from './utils'

export const MapDataContext = React.createContext()

const initialState = {
  data: [],
  dataSet: [],
  meta: {
    maxYear: 0,
    minYear: 0
  },
  filter: {},
  status: {},
  near: {},
  viewState: {}
}

export function MapsProvider (props) {
  const [state, dispatch] = React.useReducer(reducer, { ...initialState, ...props })
  const thunk = thunkDispatch(dispatch, state)
  const value = React.useMemo(() => [state, thunk], [state, thunk])
  return <MapDataContext.Provider value={value} {...props} />
}
