"use strict";

exports.__esModule = true;
exports.useCollectionDatasetSync = useCollectionDatasetSync;
var _react = require("react");
var _CollectionDatasetSyncState = require("../state/CollectionDatasetSync/CollectionDatasetSyncState");
function useCollectionDatasetSync(collection, props) {
  const [state] = (0, _react.useState)(() => new _CollectionDatasetSyncState.CollectionDatasetSyncState({
    dataset: props.dataset,
    onDatasetChange: props.onDatasetChange,
    collection
  }));
  state.onDatasetChange = props.onDatasetChange;
  (0, _react.useEffect)(() => state.init(), [state]);
  (0, _react.useEffect)(() => {
    state.setDataset(props.dataset);
  }, [props.dataset]);
}
//# sourceMappingURL=useCollectionDatasetSync.js.map